home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / samba / patches / samba-1.006 / samba-1
Encoding:
Text File  |  1996-05-31  |  79.7 KB  |  2,595 lines

  1. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/docs/samba.faq samba-1.9.16alpha4/docs/samba.faq
  2. --- samba-1.9.16alpha3/docs/samba.faq    Wed May 29 17:54:12 1996
  3. +++ samba-1.9.16alpha4/docs/samba.faq    Sat Jun  1 01:13:35 1996
  4. @@ -511,6 +511,74 @@
  5.  Each time you start your computer (or login for Win95) your PC will
  6.  synchronize it's clock with your Samba server.
  7.  
  8. +
  9. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  10. +* 4: Problems with WinDD, NTrigue, WinCenterPro etc
  11. +
  12. +All of the above programs are applications that sit on an NT box and
  13. +allow multiple users to access the NT GUI applications from remote
  14. +workstations (often over X).
  15. +
  16. +What has this got to do with Samba? The problem comes when these users
  17. +use filemanager to mount shares from a Samba server. The most common
  18. +symptom is that the first user to connect get correct file permissions
  19. +and has a nice day, but subsequent connections get logged in as the
  20. +same user as the first person to login. They find that they cannot
  21. +access files in their own home directory, but that they can access
  22. +files in the first users home directory (maybe not such a nice day
  23. +after all?)
  24. +
  25. +Why does this happen? The above products all share a common heritage
  26. +(and code base I believe). They all open just a single TCP based SMB
  27. +connection to the Samba server, and requests from all users are piped
  28. +over this connection. This is unfortunate, but not fatal.
  29. +
  30. +It means that if you run your Samba server in share level security
  31. +(the default) then things will definately break as described above. The
  32. +share level SMB security model has no provision for multiple user IDs
  33. +on the one SMB connection. See security_level.txt in the docs for more
  34. +info on share/user/server level security.
  35. +
  36. +If you run in user or server level security then you have a chance,
  37. +but only if you have a recent version of Samba (at least 1.9.15p6). In
  38. +older versions bugs in Samba meant you still would have had problems.
  39. +
  40. +If you have a trapdoor uid system in your OS then it will never work
  41. +properly. Samba needs to be able to switch uids on the connection and
  42. +it can't if your OS has a trapdoor uid system. You'll know this
  43. +because Samba will note it in your logs.
  44. +
  45. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  46. +* 5: Problem with printers under NT
  47. +
  48. +This info from Stefan Hergeth may be useful:
  49. +
  50. + A network-printer (with ethernetcard) is connected to the NT-Clients via
  51. + our UNIX-Fileserver (SAMBA-Server), like the configuration told by
  52. + Matthew Harrell <harrell@leech.nrl.navy.mil> (see WinNT.txt)
  53. +
  54. + 1.) If a user has choosen this printer as the default printer in his
  55. +     NT-Session and this printer is not connected to the network
  56. +     (e.g. switched off) than this user has a problem with the SAMBA-
  57. +     connection of his filesystems. It's very slow.
  58. +
  59. + 2.) If the printer is connected to the network everything works fine.
  60. +
  61. + 3.) When the smbd ist started with debug level 3, you can see that the
  62. +     NT spooling system try to connect to the printer many times. If the
  63. +     printer ist not connected to the network this request fails and the
  64. +     NT spooler is wasting a lot of time to connect to the printer service.
  65. +     This seems to be the reason for the slow network connection.
  66. +
  67. + 4.) Maybe it's possible to change this behaviour by setting different printer
  68. +     properties in the Print-Manager-Menu of NT, but i didn't try it
  69. +     yet.
  70. +
  71. + I hope this information will help in some way.
  72. +
  73. + Stefan Hergeth <hergeth@f7axp1.informatik.fh-muenchen.de>
  74. +
  75. +
  76.  ===============================================================================
  77.  SECTION FIVE: Specific client application problems
  78.  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  79. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/docs/security_level.txt samba-1.9.16alpha4/docs/security_level.txt
  80. --- samba-1.9.16alpha3/docs/security_level.txt    Thu Jan  1 10:00:00 1970
  81. +++ samba-1.9.16alpha4/docs/security_level.txt    Thu May 30 10:05:51 1996
  82. @@ -0,0 +1,78 @@
  83. +Description of SMB security levels.
  84. +----------------------------------
  85. +
  86. +
  87. +A SMB server tells the client at startup what "security level" it is
  88. +running. There are two options "share level" and "user level". Which
  89. +of these two the client receives affects the way the client then tries
  90. +to authenticate itself. It does not directly affect (to any great
  91. +extent) the way the Samba server does security. I know this is
  92. +strange, but it fits in with the client/server approach of SMB. In SMB
  93. +everything is initiated and controlled by the client, and the server
  94. +can only tell the client what is available and whether an action is
  95. +allowed. 
  96. +
  97. +I'll describe user level security first, as its simpler. In user level
  98. +security the client will send a "session setup" command directly after
  99. +the protocol negotiation. This contains a username and password. The
  100. +server can either accept or reject that username/password
  101. +combination. Note that at this stage the server has no idea what
  102. +share the client will eventually try to connect to, so it can't base
  103. +the "accept/reject" on anything other than:
  104. +
  105. +- the username/password
  106. +- the machine that the client is coming from
  107. +
  108. +If the server accepts the username/password then the client expects to
  109. +be able to mount any share (using a "tree connection") without
  110. +specifying a password. It expects that all access rights will be as
  111. +the username/password specified in the "session setup". 
  112. +
  113. +It is also possible for a client to send multiple "session setup"
  114. +requests. When the server responds it gives the client a "uid" to use
  115. +as an authentication tag for that username/password. The client can
  116. +maintain multiple authentication contexts in this way (WinDD is an
  117. +example of an application that does this)
  118. +
  119. +
  120. +Ok, now for share level security. In share level security (the default
  121. +with samba) the client authenticates itself separately for each
  122. +share. It will send a password along with each "tree connection"
  123. +(share mount). It does not explicitly send a username with this
  124. +operation. The client is expecting a password to be associated with
  125. +each share, independent of the user. This means that samba has to work
  126. +out what username the client probably wants to use. It is never
  127. +explicitly sent the username. A "real" SMB server like NT actually
  128. +associates passwords directly with shares in share level security, but
  129. +samba always uses the unix authentication scheme where it is a
  130. +username/password that is authenticated, not a "share/password".
  131. +
  132. +Many clients send a "session setup" even if the server is in share
  133. +level security. They normally send a valid username but no
  134. +password. Samba records this username is a list of "possible
  135. +usernames". When the client then does a "tree connection" it also adds
  136. +to this list the name of the share they try to connect to (useful for
  137. +home directories) and any users listed in the "user =" smb.conf
  138. +line. The password is then checked in turn against these "possible
  139. +usernames". If a match is found then the client is authenticated as
  140. +that user.
  141. +
  142. +Finally "server level" security. In server level security the samba
  143. +server reports to the client that it is in user level security. The
  144. +client then does a "session setup" as described earlier. The samba
  145. +server takes the username/password that the client sends and attempts
  146. +to login to the "password server" by sending exactly the same
  147. +username/password that it got from the client. If that server is in
  148. +user level security and accepts the password then samba accepts the
  149. +clients connection. This allows the samba server to use another SMB
  150. +server as the "password server". 
  151. +
  152. +You should also note that at the very start of all this, where the
  153. +server tells the client what security level it is in, it also tells
  154. +the client if it supports encryption. If it does then it supplies the
  155. +client with a random "cryptkey". The client will then send all
  156. +passwords in encrypted form. You have to compile samba with encryption
  157. +enabled to support this feature, and you have to maintain a separate
  158. +smbpasswd file with SMB style encrypted passwords. It is
  159. +cryptographically impossible to translate from unix style encryption
  160. +to SMB style encryption.
  161. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/docs/smb.conf.5 samba-1.9.16alpha4/docs/smb.conf.5
  162. --- samba-1.9.16alpha3/docs/smb.conf.5    Sat May  4 17:50:23 1996
  163. +++ samba-1.9.16alpha4/docs/smb.conf.5    Sat Jun  1 01:13:35 1996
  164. @@ -459,6 +459,8 @@
  165.  
  166.  default case
  167.  
  168. +delete readonly
  169. +
  170.  deny hosts
  171.  
  172.  directory
  173. @@ -831,6 +833,19 @@
  174.               path = /%S
  175.            
  176.  
  177. +.SS delete readonly (S)
  178. +This parameter allows readonly files to be deleted.  This is not normal DOS
  179. +semantics, but is allowed by Unix.
  180. +
  181. +This option may be useful for running applications such as rcs, where unix
  182. +file ownership prevents changing file permissions, and dos semantics prevent
  183. +deletion of a read only file.
  184. +
  185. +.B Default:
  186. +     delete readonly = No
  187. +
  188. +.B Example:
  189. +     delete readonly = Yes
  190.  .SS deny hosts (S)
  191.  A synonym for this parameter is 'hosts deny'.
  192.  
  193. @@ -1187,9 +1202,9 @@
  194.  This command should be a program or script which takes a printer name
  195.  as its only parameter and outputs printer status information. 
  196.  
  197. -Currently four styles of printer status information are supported;
  198. -BSD, SYSV, AIX and HPUX. This covers most unix systems. You control
  199. -which type is expected using the "printing =" option.
  200. +Currently six styles of printer status information are supported; BSD,
  201. +SYSV, AIX, HPUX, QNX and PLP. This covers most unix systems. You
  202. +control which type is expected using the "printing =" option.
  203.  
  204.  Some clients (notably Windows for Workgroups) may not correctly send the
  205.  connection number for the printer they are requesting status information
  206. @@ -1235,8 +1250,8 @@
  207.  This command should be a program or script which takes a printer name
  208.  and job number, and deletes the print job.
  209.  
  210. -Currently four styles of printer control are supported; BSD, SYSV, AIX
  211. -and HPUX. This covers most unix systems. You control which type is
  212. +Currently six styles of printer control are supported; BSD, SYSV, AIX
  213. +HPUX, QNX and PLP. This covers most unix systems. You control which type is
  214.  expected using the "printing =" option.
  215.  
  216.  If a %p is given then the printername is put in it's place. A %j is
  217. @@ -1881,8 +1896,9 @@
  218.  on your system, and also affects the default values for the "print
  219.  command", "lpq command" and "lprm command".
  220.  
  221. -Currently three printing styles are supported. They are "printing =
  222. -bsd", "printing = sysv", "printing = hpux" and "printing = aix".
  223. +Currently six printing styles are supported. They are "printing =
  224. +bsd", "printing = sysv", "printing = hpux", "printing = aix",
  225. +"printing = qnx" and "printing = plp".
  226.  
  227.  To see what the defaults are for the other print commands when using
  228.  these three options use the "testparm" program.
  229. @@ -1946,6 +1962,14 @@
  230.  
  231.  .B Example:
  232.      protocol = LANMAN1
  233. +.SS proxy name resolution (G)
  234. +
  235. +This is a boolean that controls if nmbd will respond to broadcast name
  236. +queries on behalf of other hosts. You may need to set this to no for
  237. +some older clients.
  238. +
  239. +.B Default:
  240. +    proxy name resolution = yes
  241.  .SS public (S)
  242.  A synonym for this parameter is 'guest ok'.
  243.  
  244. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/docs/smbclient.1 samba-1.9.16alpha4/docs/smbclient.1
  245. --- samba-1.9.16alpha3/docs/smbclient.1    Mon May  6 10:35:43 1996
  246. +++ samba-1.9.16alpha4/docs/smbclient.1    Sat Jun  1 01:13:36 1996
  247. @@ -44,8 +44,13 @@
  248.  ] [
  249.  .B -p
  250.  .I port number
  251. +] [
  252. +.B -c
  253. +.I command string
  254. +] [
  255.  .B -T
  256.  .I tar options
  257. +] [
  258.  .B -D
  259.  .I initial directory
  260.  ]
  261. @@ -437,6 +442,19 @@
  262.  Change to initial directory before starting. Probably only of any use
  263.  with the tar (\-T) option.
  264.  
  265. +
  266. +.RE
  267. +
  268. +.B -c
  269. +.I command string
  270. +
  271. +.RS 3
  272. +
  273. +command string is a semicolon separated list of commands to be
  274. +executed instead of prompting from stdin. -N is implied by -c.
  275. +
  276. +This is particularly useful in scripts and for printing stdin to
  277. +the server, e.g. -c 'print -'.
  278.  
  279.  .RE
  280.  
  281. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/examples/thoralf/smb.conf samba-1.9.16alpha4/examples/thoralf/smb.conf
  282. --- samba-1.9.16alpha3/examples/thoralf/smb.conf    Thu Jan  1 10:00:00 1970
  283. +++ samba-1.9.16alpha4/examples/thoralf/smb.conf    Thu May 30 13:15:11 1996
  284. @@ -0,0 +1,152 @@
  285. +; Configuration file for smbd (Samba 1.9.15p8)
  286. +; created by Thoralf Freitag. Send comments to:
  287. +; <Thoralf.Freitag@remserv.rz.fhtw-berlin.de> or
  288. +; <Thoralf.Freitag@t-online.de>
  289. +; last edit 24.04.1995 01:11
  290. +;
  291. +;
  292. +
  293. +[global]
  294. +
  295. +   protocol = NT1
  296. +                                  ;long filenames for win95
  297. +   mangle case = yes
  298. +                                  ;lower and upper letters
  299. +   mangled names = yes
  300. +   default case = lower
  301. +   case sensitive = no
  302. +   preserve case = yes
  303. +   short preserve case = yes
  304. +                     
  305. +   printing = bsd
  306. +   printcap name = /etc/printcap
  307. +   lpq cache time = 0
  308. +   workgroup = WORKGROUP
  309. +   admin users = su
  310. +                                  ;su is allowed to do all !!!
  311. +   guest account = ftp
  312. +                                  ;guest is same as user ftp
  313. +   default service = reference
  314. +                                  ;is possibly helpful to browsing under win 95
  315. +   os level = 2
  316. +   log file = /var/adm/log.smb
  317. +   max log size = 10
  318. +   debug level = 1
  319. +   share modes = yes
  320. +   lock directory = /var/adm
  321. +
  322. +[JP_360_raw]
  323. +   comment = Networkprinter queue for Olivetti JP 360 (untreated RAW format)
  324. +   browseable = yes
  325. +   available = yes
  326. +   public = no
  327. +   force user = root
  328. +   writable = no
  329. +   printable = yes
  330. +   printer name = samba
  331. +                                  ;samba is an alias name for an raw_printer in your /etc/printcap
  332. +   path = /samba/tmp
  333. +   create mode = 0700
  334. +
  335. +[JP_360_mono]
  336. +   comment = Networkprinter queue for Olivetti JP 360 Mono (with apsfilter)
  337. +   browseable = yes
  338. +   available = yes
  339. +   public = no
  340. +   force user = root
  341. +   writable = no
  342. +   printable = yes
  343. +   printer name = lp
  344. +                                  ;lp means the standard printer in your /etc/printcap
  345. +   path = /samba/tmp
  346. +   create mode = 0700
  347. +
  348. +[JP_360_color]
  349. +   comment = Networkprinter queue for Olivetti JP 360 Color (with apsfilter)
  350. +   browseable = yes
  351. +   available = yes
  352. +   public = no
  353. +   force user = root
  354. +   writable = no
  355. +   printable = yes
  356. +   printer name = lp4
  357. +                                  ;my printer need this to print with his color cartridge
  358. +                                  ;--> the lpd is drive to the printer as an color printer
  359. +   path = /samba/tmp
  360. +   create mode = 0700
  361. +
  362. +[tmp]
  363. +   comment = the garbage dump
  364. +   browseable = yes
  365. +   available = yes
  366. +   public = yes
  367. +   read only = no
  368. +   printable = no
  369. +   path = /samba/tmp
  370. +   create mask = 0777
  371. +
  372. +[transfer]
  373. +   comment = the market place
  374. +   browseable = yes
  375. +   available = yes
  376. +   public = yes
  377. +   read only = no
  378. +   printable = no
  379. +   path = /samba/transfer
  380. +   create mask = 0777
  381. +
  382. +[homes]
  383. +   comment = home directories
  384. +   browseable = no
  385. +                                  ;ONLY the home-dirs are visible, not the service itself
  386. +   available = yes
  387. +   guest ok = no
  388. +   read only = no
  389. +   printable = no
  390. +   create mode = 0700
  391. +
  392. +[install]
  393. +   comment = all of the many install files
  394. +   browsable = yes
  395. +   available = yes
  396. +   public = no
  397. +   username = @root, @users
  398. +   writable = yes
  399. +   read list = @users
  400. +   printable = no
  401. +   path = /samba/install
  402. +   create mode = 0755
  403. +
  404. +[doc-help]
  405. +   comment = documentations, helpfiles, FAQ's
  406. +   browsable = yes
  407. +   available = yes
  408. +   public = no
  409. +   username = @root, @users
  410. +   writable = yes
  411. +   read list = @users
  412. +   printable = no
  413. +   path = /samba/doc
  414. +   create mode = 0755
  415. +                
  416. +[cd_rom_2]
  417. +   comment = the CD in the CD-ROM drive on PANDORA
  418. +   browsable = yes
  419. +   available = yes
  420. +   public = yes
  421. +   writable = no
  422. +   printable = no
  423. +   path = /cdrom
  424. +
  425. +[reference]
  426. +                                  ;the default, if invalid accesses
  427. +   comment = PANDORA: Samba LAN manager
  428. +   browsable = yes
  429. +                                  ;only as an hint
  430. +   available = no
  431. +                                  ;however no access possible
  432. +   public = yes
  433. +   writable = no
  434. +   printable = no
  435. +   path = /samba/tmp
  436. +
  437. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/.cvsignore samba-1.9.16alpha4/source/.cvsignore
  438. --- samba-1.9.16alpha3/source/.cvsignore    Sun May  5 21:08:57 1996
  439. +++ samba-1.9.16alpha4/source/.cvsignore    Sat Jun  1 01:15:11 1996
  440. @@ -1,4 +1,4 @@
  441. -Makefile.ajt
  442. +makefile
  443.  nmbd
  444.  nmblookup
  445.  smbclient
  446. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/Makefile samba-1.9.16alpha4/source/Makefile
  447. --- samba-1.9.16alpha3/source/Makefile    Mon May  6 10:35:45 1996
  448. +++ samba-1.9.16alpha4/source/Makefile    Sat Jun  1 01:15:11 1996
  449. @@ -500,7 +500,7 @@
  450.  INCLUDES = $(INCLUDES1) $(INCLUDES2)
  451.  
  452.  UTILOBJ1 = util.o system.o charset.o kanji.o fault.o smbencrypt.o charcnv.o
  453. -UTILOBJ = $(UTILOBJ1) md4.o loadparm.o params.o pcap.o username.o
  454. +UTILOBJ = $(UTILOBJ1) md4.o loadparm.o params.o pcap.o username.o time.o
  455.  PARAMOBJ = $(UTILOBJ) ufc.o smbpass.o access.o 
  456.  SMBDOBJ1 = $(PARAMOBJ) trans2.o message.o dir.o printing.o locking.o
  457.  SMBDOBJ2 = ipc.o reply.o mangle.o chgpasswd.o password.o quotas.o
  458. @@ -527,7 +527,7 @@
  459.  
  460.  nmbd: nameserv.o nmblib.o nmbsync.o $(UTILOBJ) 
  461.      @echo Linking nmbd
  462. -    @$(CC) $(CFLAGS) -o nmbd nameserv.o nmblib.o nmbsync.o $(PARAMOBJ) $(LIBS)
  463. +    @$(CC) $(CFLAGS) -o nmbd nameserv.o nmblib.o nmbsync.o $(UTILOBJ) $(LIBS)
  464.  
  465.  smbclient: client.o clitar.o getsmbpass.o nmblib.o $(UTILOBJ) 
  466.      @echo Linking smbclient
  467. @@ -555,7 +555,7 @@
  468.      @$(SHELL) $(srcdir)installbin.sh $(INSTALLPERMS) $(BASEDIR) $(BINDIR) $(LIBDIR) $(VARDIR) $(PROGS)
  469.  
  470.  installscripts:
  471. -    @$(SHELL) $(srcdir)installbin.sh $(INSTALLPERMS) $(BASEDIR) $(BINDIR) $(LIBDIR) $(VARDIR) $(SCRIPTS)
  472. +    @$(SHELL) $(srcdir)installscripts.sh $(INSTALLPERMS) $(BINDIR) $(srcdir)
  473.  
  474.  # revert to the previously installed version
  475.  revert:
  476. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/client.c samba-1.9.16alpha4/source/client.c
  477. --- samba-1.9.16alpha3/source/client.c    Mon May  6 10:35:45 1996
  478. +++ samba-1.9.16alpha4/source/client.c    Sat Jun  1 01:15:11 1996
  479. @@ -38,6 +38,7 @@
  480.  pstring password = "";
  481.  pstring username="";
  482.  pstring workgroup=WORKGROUP;
  483. +char *cmdstr="";
  484.  BOOL got_pass = False;
  485.  BOOL connect_as_printer = False;
  486.  BOOL connect_as_ipc = False;
  487. @@ -482,7 +483,7 @@
  488.         CNV_LANG(finfo->name),
  489.         attrib_string(finfo->mode),
  490.         finfo->size,
  491. -       asctime(LocalTime(&t,GMT_TO_LOCAL))));
  492. +       asctime(LocalTime(&t))));
  493.  }
  494.  
  495.  /****************************************************************************
  496. @@ -2669,7 +2670,7 @@
  497.      {
  498.        newer_than = sbuf.st_mtime;
  499.        DEBUG(1,("Getting files newer than %s",
  500. -           asctime(LocalTime(&newer_than,GMT_TO_LOCAL))));
  501. +           asctime(LocalTime(&newer_than))));
  502.      }
  503.    else
  504.      newer_than = 0;
  505. @@ -3031,7 +3032,7 @@
  506.      static BOOL done_time = False;
  507.      if (!done_time) {
  508.        DEBUG(1,("Server time is %sTimezone is UTC%+02.1f\n",
  509. -           asctime(LocalTime(&servertime,GMT_TO_LOCAL)),
  510. +           asctime(LocalTime(&servertime)),
  511.             -(double)(serverzone/3600.0)));
  512.        done_time = True;
  513.      }
  514. @@ -4002,6 +4003,7 @@
  515.  {
  516.    extern FILE *dbf;
  517.    pstring line;
  518. +  char *cmd;
  519.  
  520.    char *InBuffer = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN);
  521.    char *OutBuffer = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN);
  522. @@ -4016,7 +4018,44 @@
  523.  
  524.    if (*base_directory) do_cd(base_directory);
  525.  
  526. -  while (!feof(stdin))
  527. +  cmd = cmdstr;
  528. +  if (cmd[0] != '\0') while (cmd[0] != '\0')
  529. +    {
  530. +      char *p;
  531. +      fstring tok;
  532. +      int i;
  533. +
  534. +      if ((p = strchr(cmd, ';')) == 0)
  535. +    {
  536. +      strncpy(line, cmd, 999);
  537. +      line[1000] = '\0';
  538. +      cmd += strlen(cmd);
  539. +    }
  540. +      else
  541. +    {
  542. +      if (p - cmd > 999) p = cmd + 999;
  543. +      strncpy(line, cmd, p - cmd);
  544. +      line[p - cmd] = '\0';
  545. +      cmd = p + 1;
  546. +    }
  547. +
  548. +      /* input language code to internal one */
  549. +      CNV_INPUT (line);
  550. +      
  551. +      /* and get the first part of the command */
  552. +      {
  553. +    char *ptr = line;
  554. +    if (!next_token(&ptr,tok,NULL)) continue;
  555. +      }
  556. +
  557. +      if ((i = process_tok(tok)) >= 0)
  558. +    commands[i].fn(InBuffer,OutBuffer);
  559. +      else if (i == -2)
  560. +    DEBUG(0,("%s: command abbreviation ambiguous\n",CNV_LANG(tok)));
  561. +      else
  562. +    DEBUG(0,("%s: command not found\n",CNV_LANG(tok)));
  563. +    }
  564. +  else while (!feof(stdin))
  565.      {
  566.        fstring tok;
  567.        int i;
  568. @@ -4099,6 +4138,7 @@
  569.    DEBUG(0,("\t-E                    write messages to stderr instead of stdout\n"));
  570.    DEBUG(0,("\t-U username           set the network username\n"));
  571.    DEBUG(0,("\t-W workgroup          set the workgroup name\n"));
  572. +  DEBUG(0,("\t-c command string     execute semicolon separated commands\n"));
  573.  #ifdef KANJI
  574.    DEBUG(0,("\t-t terminal code      terminal i/o code {sjis|euc|jis7|jis8|junet|hex}\n"));
  575.  #endif /* KANJI */
  576. @@ -4195,10 +4235,9 @@
  577.  
  578.  #ifdef KANJI
  579.    setup_term_code (KANJI);
  580. -  while ((opt = getopt (argc, argv, "B:O:M:i:Nn:d:Pp:l:hI:EB:U:L:t:m:W:T:D:")) != EOF)
  581. -#else
  582. -  while ((opt = getopt (argc, argv, "B:O:M:i:Nn:d:Pp:l:hI:EB:U:L:m:W:T:D:")) != EOF)
  583. -#endif /* KANJI */
  584. +#endif
  585. +  while ((opt = 
  586. +      getopt(argc, argv,"B:O:M:i:Nn:d:Pp:l:hI:EB:U:L:t:m:W:T:D:c:")) != EOF)
  587.      switch (opt)
  588.        {
  589.        case 'm':
  590. @@ -4281,19 +4320,23 @@
  591.        case 'p':
  592.      port = atoi(optarg);
  593.      break;
  594. +      case 'c':
  595. +    cmdstr = optarg;
  596. +    got_pass = True;
  597. +    break;
  598.        case 'h':
  599.      usage(pname);
  600.      exit(0);
  601.      break;
  602. -#ifdef KANJI
  603.        case 't':
  604. +#ifdef KANJI
  605.      if (!setup_term_code (optarg)) {
  606.          DEBUG(0, ("%s: unknown terminal code name\n", optarg));
  607.          usage (pname);
  608.          exit (1);
  609.      }
  610. +#endif
  611.      break;
  612. -#endif /* KANJI */
  613.        default:
  614.      usage(pname);
  615.      exit(1);
  616. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/clitar.c samba-1.9.16alpha4/source/clitar.c
  617. --- samba-1.9.16alpha3/source/clitar.c    Sat May  4 17:50:23 1996
  618. +++ samba-1.9.16alpha4/source/clitar.c    Sat Jun  1 01:15:11 1996
  619. @@ -591,7 +591,7 @@
  620.    put_dos_date3(outbuf,smb_vwv1,finfo.mtime);
  621.    
  622.    DEBUG(3,("Setting date to %s (0x%X)",
  623. -       asctime(LocalTime(&finfo.mtime,GMT_TO_LOCAL)),
  624. +       asctime(LocalTime(&finfo.mtime)),
  625.         finfo.mtime));
  626.    
  627.    send_smb(Client,outbuf);
  628. @@ -1655,7 +1655,7 @@
  629.      if (sys_stat(argv[Optind], &stbuf) == 0) {
  630.        newer_than = stbuf.st_mtime;
  631.        DEBUG(1,("Getting files newer than %s",
  632. -           asctime(LocalTime(&newer_than,GMT_TO_LOCAL))));
  633. +           asctime(LocalTime(&newer_than))));
  634.        Optind++;
  635.      } else {
  636.        DEBUG(0,("Error setting newer-than time\n"));
  637. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/cvs.log samba-1.9.16alpha4/source/cvs.log
  638. --- samba-1.9.16alpha3/source/cvs.log    Wed May 29 17:54:54 1996
  639. +++ samba-1.9.16alpha4/source/cvs.log    Sat Jun  1 01:16:32 1996
  640. @@ -755,3 +755,213 @@
  641.  
  642.  
  643.  
  644. +
  645. +****************************************
  646. +Date:    Wednesday May 29, 1996 @ 17:55
  647. +Author:    samba-bu
  648. +
  649. +Update of /data/cvs/samba/source
  650. +In directory arvidsjaur:/samba/samba-bugs/samba/source
  651. +
  652. +Modified Files:
  653. +    cvs.log version.h 
  654. +Log Message:
  655. +preparing for release of 1.9.16alpha3
  656. +
  657. +
  658. +****************************************
  659. +Date:    Wednesday May 29, 1996 @ 23:37
  660. +Author:    samba-bu
  661. +
  662. +Update of /data/cvs/samba/source
  663. +In directory arvidsjaur:/samba/samba-bugs/samba/source
  664. +
  665. +Removed Files:
  666. +    cvs.log 
  667. +Log Message:
  668. +remove cvs.log from cvs, instead use the release script to copy it to
  669. +the right places
  670. +
  671. +
  672. +
  673. +****************************************
  674. +Date:    Thursday May 30, 1996 @ 10:06
  675. +Author:    samba-bu
  676. +
  677. +Update of /data/cvs/samba/docs
  678. +In directory arvidsjaur:/samba/samba-bugs/samba/docs
  679. +
  680. +Added Files:
  681. +    security_level.txt 
  682. +Log Message:
  683. +added this ages ago, but forgot to put it in cvs
  684. +
  685. +
  686. +****************************************
  687. +Date:    Thursday May 30, 1996 @ 13:07
  688. +Author:    tridge
  689. +
  690. +Update of /data/cvs/samba/examples/thoralf
  691. +In directory arvidsjaur:/var/tmp/cvs-serv13278/thoralf
  692. +
  693. +Log Message:
  694. +Directory /data/cvs/samba/examples/thoralf added to the repository
  695. +
  696. +
  697. +
  698. +****************************************
  699. +Date:    Thursday May 30, 1996 @ 13:15
  700. +Author:    tridge
  701. +
  702. +Update of /data/cvs/samba/docs
  703. +In directory arvidsjaur:/var/tmp/cvs-serv13461
  704. +
  705. +Modified Files:
  706. +    samba.faq 
  707. +Log Message:
  708. +- added an entry on WinDD to samba.faq
  709. +- added a sample smb.conf from Thoralf.Freitag@remserv.rz.fhtw-berlin.de
  710. +- print the errno when you get a can't change directory error
  711. +- added installscripts.sh from James_K._Foote.PARC@xerox.com
  712. +
  713. +
  714. +
  715. +****************************************
  716. +Date:    Thursday May 30, 1996 @ 13:15
  717. +Author:    tridge
  718. +
  719. +Update of /data/cvs/samba/examples/thoralf
  720. +In directory arvidsjaur:/var/tmp/cvs-serv13485
  721. +
  722. +Added Files:
  723. +    smb.conf 
  724. +Log Message:
  725. +- added an entry on WinDD to samba.faq
  726. +- added a sample smb.conf from Thoralf.Freitag@remserv.rz.fhtw-berlin.de
  727. +- print the errno when you get a can't change directory error
  728. +- added installscripts.sh from James_K._Foote.PARC@xerox.com
  729. +
  730. +
  731. +
  732. +****************************************
  733. +Date:    Thursday May 30, 1996 @ 13:15
  734. +Author:    tridge
  735. +
  736. +Update of /data/cvs/samba/source
  737. +In directory arvidsjaur:/var/tmp/cvs-serv13502
  738. +
  739. +Modified Files:
  740. +    Makefile server.c 
  741. +Added Files:
  742. +    installscripts.sh 
  743. +Log Message:
  744. +- added an entry on WinDD to samba.faq
  745. +- added a sample smb.conf from Thoralf.Freitag@remserv.rz.fhtw-berlin.de
  746. +- print the errno when you get a can't change directory error
  747. +- added installscripts.sh from James_K._Foote.PARC@xerox.com
  748. +
  749. +
  750. +
  751. +****************************************
  752. +Date:    Friday May 31, 1996 @ 16:09
  753. +Author:    tridge
  754. +
  755. +Update of /data/cvs/samba/source
  756. +In directory arvidsjaur:/var/tmp/cvs-serv14715
  757. +
  758. +Modified Files:
  759. +    reply.c 
  760. +Log Message:
  761. +comment out the code that tries to handle the NT bug where the 2nd
  762. +passlen is wrong. The fix is worse than the problem :-)
  763. +
  764. +
  765. +
  766. +****************************************
  767. +Date:    Friday May 31, 1996 @ 16:10
  768. +Author:    tridge
  769. +
  770. +Update of /data/cvs/samba/source
  771. +In directory arvidsjaur:/var/tmp/cvs-serv14774
  772. +
  773. +Modified Files:
  774. +    .cvsignore 
  775. +Log Message:
  776. +add my private makefile to the ignore list
  777. +
  778. +
  779. +
  780. +
  781. +****************************************
  782. +Date:    Saturday June 1, 1996 @ 1:09
  783. +Author:    tridge
  784. +
  785. +Update of /data/cvs/samba/docs
  786. +In directory arvidsjaur:/var/tmp/cvs-serv27355
  787. +
  788. +Modified Files:
  789. +    samba.faq smb.conf.5 smbclient.1 
  790. +Log Message:
  791. +Lots of changes!
  792. +
  793. +- add faq info on NT printer handling
  794. +- add "delete readonly" option to help rcs users
  795. +- add stuff to man pages on new printer options
  796. +- add "proxy name resolution" option
  797. +- add "command string" -c option to smbclient (thanks Ken)
  798. +- split time functions into time.c
  799. +- rearrange the quotas stuff a bit and fix some bugs
  800. +- complete rehash of the time handling code thanks to Paul Eggert
  801. +- fix nmblookup output a bit
  802. +- add plp print queue parsing from Bertrand Wallrich
  803. +
  804. +
  805. +
  806. +
  807. +
  808. +
  809. +****************************************
  810. +Date:    Saturday June 1, 1996 @ 1:13
  811. +Author:    tridge
  812. +
  813. +Update of /data/cvs/samba/source
  814. +In directory arvidsjaur:/var/tmp/cvs-serv27417
  815. +
  816. +Modified Files:
  817. +    Makefile client.c clitar.c includes.h ipc.c loadparm.c 
  818. +    loadparm.h local.h nameserv.c nmblib.c password.c printing.c 
  819. +    quotas.c reply.c server.c smb.h smbpasswd.c status.c 
  820. +    testparm.c testprns.c util.c 
  821. +Added Files:
  822. +    time.c 
  823. +Log Message:
  824. +Lots of changes!
  825. +
  826. +- add faq info on NT printer handling
  827. +- add "delete readonly" option to help rcs users
  828. +- add stuff to man pages on new printer options
  829. +- add "proxy name resolution" option
  830. +- add "command string" -c option to smbclient (thanks Ken)
  831. +- split time functions into time.c
  832. +- rearrange the quotas stuff a bit and fix some bugs
  833. +- complete rehash of the time handling code thanks to Paul Eggert
  834. +- fix nmblookup output a bit
  835. +- add plp print queue parsing from Bertrand Wallrich
  836. +
  837. +
  838. +
  839. +
  840. +
  841. +
  842. +****************************************
  843. +Date:    Saturday June 1, 1996 @ 1:16
  844. +Author:    samba-bu
  845. +
  846. +Update of /data/cvs/samba/source
  847. +In directory arvidsjaur:/samba/samba-bugs/samba/source
  848. +
  849. +Modified Files:
  850. +    version.h 
  851. +Log Message:
  852. +preparing for release of 1.9.16alpha4
  853. +
  854. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/includes.h samba-1.9.16alpha4/source/includes.h
  855. --- samba-1.9.16alpha3/source/includes.h    Sun May  5 17:18:39 1996
  856. +++ samba-1.9.16alpha4/source/includes.h    Sat Jun  1 01:15:11 1996
  857. @@ -198,27 +198,6 @@
  858.  #include <shadow.h>
  859.  #endif
  860.  
  861. -/* this might be different on different systems */
  862. -#ifdef QUOTAS 
  863. -#ifdef LINUX
  864. -#ifdef __KERNEL__
  865. -#undef __KERNEL__
  866. -#include <sys/quota.h>
  867. -#define __KERNEL__
  868. -#else
  869. -#include <sys/quota.h>
  870. -#endif
  871. -#include <mntent.h>
  872. -#else
  873. -#include <sys/quota.h>
  874. -#ifndef CRAY
  875. -#include <devnm.h>
  876. -#else
  877. -#include <mntent.h>
  878. -#endif
  879. -#endif
  880. -#endif
  881. -
  882.  #ifdef SYSLOG
  883.  #include <syslog.h>
  884.  #endif
  885. @@ -499,6 +478,8 @@
  886.  #define USE_WAITPID
  887.  #define SIGNAL_CAST (void (*)())
  888.  #define DEFAULT_PRINTING PRINT_AIX
  889. +/* we undef this because sys/param.h is broken in aix. uggh. */
  890. +#undef MAXHOSTNAMELEN
  891.  #endif
  892.  
  893.  
  894. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/installscripts.sh samba-1.9.16alpha4/source/installscripts.sh
  895. --- samba-1.9.16alpha3/source/installscripts.sh    Thu Jan  1 10:00:00 1970
  896. +++ samba-1.9.16alpha4/source/installscripts.sh    Thu May 30 13:15:57 1996
  897. @@ -0,0 +1,26 @@
  898. +#!/bin/sh
  899. +# this script courtesy of James_K._Foote.PARC@xerox.com
  900. +INSTALLPERMS=$1
  901. +BINDIR=$2
  902. +SRCDIR=$3
  903. +
  904. +echo Installing scripts in $BINDIR
  905. +
  906. +for d in $BINDIR; do
  907. + if [ ! -d $d ]; then
  908. +  mkdir $d
  909. +  if [ ! -d $d ]; then
  910. +    echo Failed to make directory $d
  911. +    exit 1
  912. +  fi
  913. + fi
  914. +done
  915. +
  916. +cp $SRCDIR/smbtar $BINDIR
  917. +cp $SRCDIR/addtosmbpass $BINDIR
  918. +echo Setting permissions on scripts
  919. +chmod $INSTALLPERMS $BINDIR/smbtar
  920. +chmod $INSTALLPERMS $BINDIR/addtosmbpass
  921. +
  922. +echo Scripts installed
  923. +exit 0
  924. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/ipc.c samba-1.9.16alpha4/source/ipc.c
  925. --- samba-1.9.16alpha3/source/ipc.c    Sun May  5 17:18:39 1996
  926. +++ samba-1.9.16alpha4/source/ipc.c    Sat Jun  1 01:15:12 1996
  927. @@ -467,7 +467,7 @@
  928.    time_t t = queue->time;
  929.  
  930.    /* the client expects localtime */
  931. -  t += GMT_TO_LOCAL*TimeDiff(t);
  932. +  t -= TimeDiff(t);
  933.  
  934.    PACKI(desc,"W",((snum%0xFF)<<8) | (queue->job%0xFF)); /* uJobId */
  935.    if (uLevel == 1) {
  936. @@ -479,7 +479,7 @@
  937.      PACKI(desc,"W",n+1);        /* uPosition */
  938.      PACKI(desc,"W",queue->status); /* fsStatus */
  939.      PACKS(desc,"z","");        /* pszStatus */
  940. -    PACKI(desc,"D",queue->time); /* ulSubmitted */
  941. +    PACKI(desc,"D",t); /* ulSubmitted */
  942.      PACKI(desc,"D",queue->size); /* ulSize */
  943.      PACKS(desc,"z",queue->file); /* pszComment */
  944.    }
  945. @@ -488,7 +488,7 @@
  946.      PACKS(desc,"z",queue->user); /* pszUserName */
  947.      PACKI(desc,"W",n+1);        /* uPosition */
  948.      PACKI(desc,"W",queue->status); /* fsStatus */
  949. -    PACKI(desc,"D",queue->time); /* ulSubmitted */
  950. +    PACKI(desc,"D",t); /* ulSubmitted */
  951.      PACKI(desc,"D",queue->size); /* ulSize */
  952.      PACKS(desc,"z","Samba");    /* pszComment */
  953.      PACKS(desc,"z",queue->file); /* pszDocument */
  954. @@ -1289,7 +1289,7 @@
  955.  
  956.      /* the client expects to get localtime, not GMT, in this bit 
  957.         (I think, this needs testing) */
  958. -    t = LocalTime(&unixdate,GMT_TO_LOCAL);
  959. +    t = LocalTime(&unixdate);
  960.  
  961.      SIVAL(p,4,0);        /* msecs ? */
  962.      CVAL(p,8) = t->tm_hour;
  963. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/loadparm.c samba-1.9.16alpha4/source/loadparm.c
  964. --- samba-1.9.16alpha3/source/loadparm.c    Sat May  4 17:50:24 1996
  965. +++ samba-1.9.16alpha4/source/loadparm.c    Sat Jun  1 01:15:12 1996
  966. @@ -161,6 +161,7 @@
  967.     BOOL bReadbmpx;
  968.     BOOL bSyslogOnly;
  969.     BOOL bBrowseList;
  970. +   BOOL bProxyNameResolution;
  971.  } global;
  972.  
  973.  static global Globals;
  974. @@ -236,6 +237,7 @@
  975.    BOOL bSyncAlways;
  976.    char magic_char;
  977.    BOOL *copymap;
  978. +  BOOL bDeleteReadonly;
  979.    char dummy[3]; /* for alignment */
  980.  } service;
  981.  
  982. @@ -307,6 +309,7 @@
  983.    False, /* bSyncAlways */
  984.    '~',   /* magic char */
  985.    NULL,  /* copymap */
  986. +  False, /* bDeleteReadonly */
  987.    ""     /* dummy */
  988.  };
  989.  
  990. @@ -413,6 +416,7 @@
  991.    {"domain master",    P_BOOL,    P_GLOBAL, &Globals.bDomainMaster,     NULL},
  992.    {"domain logons",    P_BOOL,    P_GLOBAL, &Globals.bDomainLogons,     NULL},
  993.    {"browse list",      P_BOOL,    P_GLOBAL, &Globals.bBrowseList,       NULL},
  994. +  {"proxy name resolution",P_BOOL,P_GLOBAL,&Globals.bProxyNameResolution,NULL},
  995.  
  996.    {"-valid",           P_BOOL,    P_LOCAL,  &sDefault.valid,            NULL},
  997.    {"comment",          P_STRING,  P_LOCAL,  &sDefault.comment,          NULL},
  998. @@ -493,6 +497,7 @@
  999.    {"magic script",     P_STRING,  P_LOCAL,  &sDefault.szMagicScript,    NULL},
  1000.    {"magic output",     P_STRING,  P_LOCAL,  &sDefault.szMagicOutput,    NULL},
  1001.    {"mangled map",      P_STRING,  P_LOCAL,  &sDefault.szMangledMap,     NULL},
  1002. +  {"delete readonly",  P_BOOL,    P_LOCAL,  &sDefault.bDeleteReadonly,  NULL},
  1003.  
  1004.    {NULL,               P_BOOL,    P_NONE,   NULL,                       NULL}
  1005.  };
  1006. @@ -568,6 +573,7 @@
  1007.    Globals.bDomainMaster = False;
  1008.    Globals.bDomainLogons = False;
  1009.    Globals.bBrowseList = True;
  1010. +  Globals.bProxyNameResolution = True;
  1011.  
  1012.  #ifdef KANJI
  1013.    coding_system = interpret_coding_system (KANJI, SJIS_CODE);
  1014. @@ -595,6 +601,7 @@
  1015.      {
  1016.      case PRINT_BSD:
  1017.      case PRINT_AIX:
  1018. +    case PRINT_PLP:
  1019.        string_initial(&sDefault.szLpqcommand,"lpq -P%p");
  1020.        string_initial(&sDefault.szLprmcommand,"lprm -P%p %j");
  1021.        string_initial(&sDefault.szPrintcommand,"lpr -r -P%p %s");
  1022. @@ -705,6 +712,7 @@
  1023.  FN_GLOBAL_BOOL(lp_encrypted_passwords,&Globals.bEncryptPasswords)
  1024.  FN_GLOBAL_BOOL(lp_syslog_only,&Globals.bSyslogOnly)
  1025.  FN_GLOBAL_BOOL(lp_browse_list,&Globals.bBrowseList)
  1026. +FN_GLOBAL_BOOL(lp_proxy_name_resolution,&Globals.bProxyNameResolution)
  1027.  
  1028.  FN_GLOBAL_INTEGER(lp_os_level,&Globals.os_level)
  1029.  FN_GLOBAL_INTEGER(lp_max_ttl,&Globals.max_ttl)
  1030. @@ -778,6 +786,7 @@
  1031.  FN_LOCAL_BOOL(lp_widelinks,bWidelinks)
  1032.  FN_LOCAL_BOOL(lp_syncalways,bSyncAlways)
  1033.  FN_LOCAL_BOOL(lp_map_system,bMap_system)
  1034. +FN_LOCAL_BOOL(lp_delete_readonly,bDeleteReadonly)
  1035.  
  1036.  FN_LOCAL_INTEGER(lp_create_mode,iCreate_mode)
  1037.  FN_LOCAL_INTEGER(lp_max_connections,iMaxConnections)
  1038. @@ -1291,6 +1300,8 @@
  1039.      *val = PRINT_BSD;
  1040.    else if (strequal(pszParmValue,"qnx"))
  1041.      *val = PRINT_QNX;
  1042. +  else if (strequal(pszParmValue,"plp"))
  1043. +    *val = PRINT_PLP;
  1044.    return(True);
  1045.  }
  1046.  
  1047. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/loadparm.h samba-1.9.16alpha4/source/loadparm.h
  1048. --- samba-1.9.16alpha3/source/loadparm.h    Sat May  4 17:50:24 1996
  1049. +++ samba-1.9.16alpha4/source/loadparm.h    Sat Jun  1 01:15:12 1996
  1050. @@ -79,6 +79,7 @@
  1051.  extern BOOL lp_encrypted_passwords(void);
  1052.  extern BOOL lp_syslog_only(void);
  1053.  extern BOOL lp_browse_list(void);
  1054. +extern BOOL lp_proxy_name_resolution(void);
  1055.  extern int  lp_numservices(void);
  1056.  extern int  lp_keepalive(void);
  1057.  extern int  lp_passwordlevel(void);
  1058. @@ -154,6 +155,7 @@
  1059.  extern int lp_max_connections(int iService);
  1060.  extern BOOL lp_add_home(char *pservice,int ifrom,char *phome);
  1061.  extern char *lp_string(char *s);
  1062. +extern BOOL lp_delete_readonly(int iService);
  1063.  char *my_workgroup(void);
  1064.  
  1065.  #endif
  1066. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/local.h samba-1.9.16alpha4/source/local.h
  1067. --- samba-1.9.16alpha3/source/local.h    Mon May  6 10:35:45 1996
  1068. +++ samba-1.9.16alpha4/source/local.h    Sat Jun  1 01:15:12 1996
  1069. @@ -83,12 +83,6 @@
  1070.     manager window? */
  1071.  #define FSTYPE_STRING "Samba"
  1072.  
  1073. -/* we have two time standards - local and GMT. This will try to sort them out.
  1074. - */
  1075. -
  1076. -#define LOCAL_TO_GMT 1
  1077. -#define GMT_TO_LOCAL (-1)
  1078. -
  1079.  /* do you want smbd to send a 1 byte packet to nmbd to trigger it to start 
  1080.     when smbd starts? */
  1081.  #ifndef PRIME_NMBD
  1082. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/nameserv.c samba-1.9.16alpha4/source/nameserv.c
  1083. --- samba-1.9.16alpha3/source/nameserv.c    Sat May  4 17:50:24 1996
  1084. +++ samba-1.9.16alpha4/source/nameserv.c    Sat Jun  1 01:15:12 1996
  1085. @@ -1798,6 +1798,11 @@
  1086.        return;
  1087.      }
  1088.  
  1089. +    if (!lp_proxy_name_resolution() && n->source != SELF) {
  1090. +      DEBUG(3,("no proxy resolution\n"));
  1091. +      return;
  1092. +    }
  1093. +
  1094.      /* don't respond to bcast queries for addresses on the same net as the 
  1095.         machine doing the querying unless its our IP */
  1096.      if (bcast && 
  1097. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/nmblib.c samba-1.9.16alpha4/source/nmblib.c
  1098. --- samba-1.9.16alpha3/source/nmblib.c    Sat May  4 17:50:24 1996
  1099. +++ samba-1.9.16alpha4/source/nmblib.c    Sat Jun  1 01:15:12 1996
  1100. @@ -625,16 +625,17 @@
  1101.        char qname[17];
  1102.        int type;
  1103.        fstring flags;
  1104. +      int i;
  1105.        *flags = 0;
  1106.        StrnCpy(qname,p,15);
  1107.        type = CVAL(p,15);
  1108.        p += 16;
  1109.  
  1110. -      if (p[0] & 0x80) strcat(flags,"<GROUP> ");
  1111. -      if ((p[0] & 0x60) == 0) strcat(flags,"B ");
  1112. -      if ((p[0] & 0x60) == 1) strcat(flags,"P ");
  1113. -      if ((p[0] & 0x60) == 2) strcat(flags,"M ");
  1114. -      if ((p[0] & 0x60) == 3) strcat(flags,"_ ");
  1115. +      strcat(flags, (p[0] & 0x80) ? "<GROUP> " : "        ");
  1116. +      if ((p[0] & 0x60) == 0x00) strcat(flags,"B ");
  1117. +      if ((p[0] & 0x60) == 0x20) strcat(flags,"P ");
  1118. +      if ((p[0] & 0x60) == 0x40) strcat(flags,"M ");
  1119. +      if ((p[0] & 0x60) == 0x60) strcat(flags,"_ ");
  1120.        if (p[0] & 0x10) strcat(flags,"<DEREGISTERING> ");
  1121.        if (p[0] & 0x08) strcat(flags,"<CONFLICT> ");
  1122.        if (p[0] & 0x04) strcat(flags,"<ACTIVE> ");
  1123. @@ -650,7 +651,10 @@
  1124.      trim_string(rname,NULL," ");
  1125.        }
  1126.        
  1127. -      DEBUG(level,("\t%s (type=0x%x)\t%s\n",qname,type,flags));
  1128. +      for (i = strlen( qname) ; --i >= 0 ; ) {
  1129. +    if (!isprint(qname[i])) qname[i] = '.';
  1130. +      }
  1131. +      DEBUG(level,("\t%-15s <%02x> - %s\n",qname,type,flags));
  1132.        p+=2;
  1133.      }
  1134.    DEBUG(level,("num_good_sends=%d num_good_receives=%d\n",
  1135. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/password.c samba-1.9.16alpha4/source/password.c
  1136. --- samba-1.9.16alpha3/source/password.c    Wed May 29 17:54:24 1996
  1137. +++ samba-1.9.16alpha4/source/password.c    Sat Jun  1 01:15:12 1996
  1138. @@ -287,15 +287,13 @@
  1139.  #ifdef OSF1_ENH_SEC
  1140.    struct pr_passwd *mypasswd;
  1141.    time_t starttime;
  1142. -  long tz;
  1143.  
  1144.    mypasswd = getprpwnam (user);
  1145.    starttime = time (NULL);
  1146. -  tz = mktime ( localtime ( &starttime ) );
  1147.  
  1148.    if (result)
  1149.      {
  1150. -      mypasswd->ufld.fd_slogin = tz;
  1151. +      mypasswd->ufld.fd_slogin = starttime;
  1152.        mypasswd->ufld.fd_nlogins = 0;
  1153.        
  1154.        putprpwnam(user,mypasswd);
  1155. @@ -304,7 +302,7 @@
  1156.      }
  1157.    else
  1158.      {
  1159. -      mypasswd->ufld.fd_ulogin = tz;
  1160. +      mypasswd->ufld.fd_ulogin = starttime;
  1161.        mypasswd->ufld.fd_nlogins = mypasswd->ufld.fd_nlogins + 1;
  1162.        if ( mypasswd->ufld.fd_max_tries != 0 && mypasswd->ufld.fd_nlogins > mypasswd->ufld.fd_max_tries )
  1163.      {
  1164. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/printing.c samba-1.9.16alpha4/source/printing.c
  1165. --- samba-1.9.16alpha3/source/printing.c    Sat May  4 17:50:24 1996
  1166. +++ samba-1.9.16alpha4/source/printing.c    Sat Jun  1 01:15:12 1996
  1167. @@ -149,7 +149,7 @@
  1168.  ********************************************************************/
  1169.  static time_t EntryTime(string tok[], int ptr, int count, int minimum)
  1170.  {
  1171. -  time_t jobtime;
  1172. +  time_t jobtime,jobtime1;
  1173.  
  1174.    jobtime = time(NULL);        /* default case: take current time */
  1175.    if (count >= minimum) {
  1176. @@ -181,7 +181,9 @@
  1177.        t->tm_hour = hour;
  1178.        t->tm_min = min;
  1179.        t->tm_sec = sec;
  1180. -      jobtime = mktime(t);
  1181. +      jobtime1 = mktime(t);
  1182. +      if (jobtime1 != (time_t)-1)
  1183. +    jobtime = jobtime1;
  1184.      }
  1185.    }
  1186.    return jobtime;
  1187. @@ -596,6 +598,78 @@
  1188.  }
  1189.  
  1190.  
  1191. +/****************************************************************************
  1192. +  parse a lpq line for the plp printing system
  1193. +  Bertrand Wallrich <Bertrand.Wallrich@loria.fr>
  1194. +****************************************************************************/
  1195. +static BOOL parse_lpq_plp(char *line,print_queue_struct *buf,BOOL first)
  1196. +{
  1197. +  string tok[5];
  1198. +  int count=0;
  1199. +
  1200. +  /* handle the case of "(standard input)" as a filename */
  1201. +  string_sub(line,"stdin","STDIN");
  1202. +  string_sub(line,"(","\"");
  1203. +  string_sub(line,")","\"");
  1204. +  
  1205. +  for (count=0; count<8 && next_token(&line,tok[count],NULL); count++) ;
  1206. +
  1207. +  /* we must get 5 tokens */
  1208. +  if (count < 8)
  1209. +    return(False);
  1210. +
  1211. +  /* the 4rd must be integer */
  1212. +  if (!isdigit(*tok[3])) return(False);
  1213. +
  1214. +  /* if the fname contains a space then use STDIN */
  1215. +  if (strchr(tok[3],' '))
  1216. +    strcpy(tok[3],"STDIN");
  1217. +
  1218. +  /* only take the last part of the filename */
  1219. +  {
  1220. +    string tmp;
  1221. +    char *p = strrchr(tok[5],'/');
  1222. +    if (p)
  1223. +      {
  1224. +        strcpy(tmp,p+1);
  1225. +        strcpy(tok[5],tmp);
  1226. +      }
  1227. +  }
  1228. +
  1229. +
  1230. +  buf->job = atoi(tok[3]);
  1231. +
  1232. +  /* calcul de la taille du fichier */
  1233. +  if (!isdigit(*tok[7])) {  buf->size = atoi(tok[7]) * 1.0 ; }
  1234. +  else {
  1235. +    string tmp;
  1236. +    strcpy(tmp,tok[7]);
  1237. +    if (strchr(tok[7],'K')) {
  1238. +      strncpy(tok[7],tmp,strlen(tmp)-1);
  1239. +      buf->size = atoi(tok[7]);
  1240. +      buf->size = buf->size * 1024;
  1241. +    }
  1242. +    if (strchr(tok[7],'M')) {
  1243. +      strncpy(tok[7],tmp,strlen(tmp)-1);
  1244. +      buf->size = atoi(tok[7]);
  1245. +      buf->size = buf->size * 1024.0 * 1000.0;
  1246. +    }
  1247. +    if (strchr(tok[7],'G')) {
  1248. +      strncpy(tok[7],tmp,strlen(tmp)-1);
  1249. +      buf->size = atoi(tok[7]);
  1250. +      buf->size = buf->size * 1024.0 * 1000000.0;
  1251. +    }
  1252. +
  1253. +  }
  1254. +  buf->status = strequal(tok[0],"active")?LPQ_PRINTING:LPQ_QUEUED;
  1255. +  buf->priority = 0;
  1256. +  buf->time = time(NULL);
  1257. +  StrnCpy(buf->user,tok[1],sizeof(buf->user)-1);
  1258. +  StrnCpy(buf->file,tok[5],sizeof(buf->file)-1);
  1259. +  return(True);
  1260. +}
  1261. +
  1262. +
  1263.  
  1264.  char *stat0_strings[] = { "enabled", "online", "idle", "no entries", "free", "ready", NULL };
  1265.  char *stat1_strings[] = { "offline", "disabled", "down", "off", "waiting", "no daemon", NULL };
  1266. @@ -623,6 +697,9 @@
  1267.        break;
  1268.      case PRINT_QNX:
  1269.        ret = parse_lpq_qnx(line,buf,first);
  1270. +      break;
  1271. +    case PRINT_PLP:
  1272. +      ret = parse_lpq_plp(line,buf,first);
  1273.        break;
  1274.      default:
  1275.        ret = parse_lpq_bsd(line,buf,first);
  1276. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/quotas.c samba-1.9.16alpha4/source/quotas.c
  1277. --- samba-1.9.16alpha3/source/quotas.c    Sun May  5 21:25:13 1996
  1278. +++ samba-1.9.16alpha4/source/quotas.c    Sat Jun  1 01:15:12 1996
  1279. @@ -1,3 +1,4 @@
  1280. +#ifdef QUOTAS
  1281.  /* 
  1282.     Unix SMB/Netbios implementation.
  1283.     Version 1.9.
  1284. @@ -19,12 +20,28 @@
  1285.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1286.  */
  1287.  
  1288. -#include "includes.h"
  1289.  
  1290. +/* 
  1291. + * This is one of the most system dependent parts of Samba, and its
  1292. + * done a litle differently. Each system has its own way of doing 
  1293. + * things :-(
  1294. + */
  1295. +
  1296. +#include "includes.h"
  1297.  
  1298. -#ifdef QUOTAS
  1299.  
  1300.  #ifdef LINUX
  1301. +
  1302. +#ifdef __KERNEL__
  1303. +# undef __KERNEL__
  1304. +# include <sys/quota.h>
  1305. +# define __KERNEL__
  1306. +#else
  1307. +# include <sys/quota.h>
  1308. +#endif
  1309. +
  1310. +#include <mntent.h>
  1311. +
  1312.  /****************************************************************************
  1313.  try to get the disk space from disk quotas (LINUX version)
  1314.  ****************************************************************************/
  1315. @@ -115,6 +132,10 @@
  1316.  }
  1317.  
  1318.  #elif defined(CRAY)
  1319. +
  1320. +#include <sys/quota.h>
  1321. +#include <mntent.h>
  1322. +
  1323.  /****************************************************************************
  1324.  try to get the disk space from disk quotas (CRAY VERSION)
  1325.  ****************************************************************************/
  1326. @@ -214,6 +235,7 @@
  1327.  
  1328.  #elif defined(SUNOS5)
  1329.  
  1330. +#include <devnm.h>
  1331.  #include <fcntl.h>
  1332.  #include <sys/fs/ufs_quota.h>
  1333.  
  1334. @@ -228,30 +250,33 @@
  1335.    struct dqblk D;
  1336.    struct quotctl command;
  1337.    int file;
  1338. +  int ret;
  1339.   
  1340.    if((file=open(path, O_RDONLY))<0) return(False);
  1341.  
  1342.    euser_id = geteuid();
  1343.    user_id = getuid();
  1344.  
  1345. -  setuid(0);  /* Solaris seems to want to give info only to super-user */
  1346. -  seteuid(0);
  1347. -
  1348.    command.op = Q_GETQUOTA;
  1349.    command.uid = euser_id;
  1350.    command.addr = (caddr_t) &D;
  1351.   
  1352. -  if(ioctl(file, Q_QUOTACTL, &command)<0)
  1353. -    {
  1354. -     close(file);
  1355. -     DEBUG(2,("disk_quotas ioctl (Solaris) failed\n"));
  1356. -     return(False);
  1357. -    }
  1358. -  close(file);
  1359. +  setuid(0);  /* Solaris seems to want to give info only to super-user */
  1360. +  seteuid(0);
  1361. +
  1362. +  ret = ioctl(file, Q_QUOTACTL, &command);
  1363.  
  1364.    setuid(user_id);  /* Restore the original UID status */
  1365.    seteuid(euser_id);
  1366.  
  1367. +  if (ret < 0) {
  1368. +    close(file);
  1369. +    DEBUG(2,("disk_quotas ioctl (Solaris) failed\n"));
  1370. +    return(False);
  1371. +  }
  1372. +  close(file);
  1373. +
  1374. +
  1375.    /* Use softlimit to determine disk space. A user exceeding the quota is told
  1376.     * that there's no space left. Writes might actually work for a bit if the
  1377.     * hardlimit is set higher than softlimit. Effectively the disk becomes
  1378. @@ -275,6 +300,9 @@
  1379.  
  1380.  #else
  1381.  
  1382. +#include <sys/quota.h>
  1383. +#include <devnm.h>
  1384. +
  1385.  /****************************************************************************
  1386.  try to get the disk space from disk quotas - default version
  1387.  ****************************************************************************/
  1388. @@ -327,4 +355,5 @@
  1389.  }
  1390.  
  1391.  #endif
  1392. -#endif
  1393. +#endif /* QUOTAS */
  1394. +
  1395. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/reply.c samba-1.9.16alpha4/source/reply.c
  1396. --- samba-1.9.16alpha3/source/reply.c    Sat May  4 17:50:24 1996
  1397. +++ samba-1.9.16alpha4/source/reply.c    Sat Jun  1 01:15:12 1996
  1398. @@ -334,11 +334,13 @@
  1399.      StrnCpy(smb_apasswd,p + passlen1,smb_apasslen);
  1400.        }
  1401.      }
  1402. +#if NT_WORKAROUND
  1403.      if (passlen2 == 1) {
  1404.        /* apparently NT sometimes sets passlen2 to 1 when it means 0. This
  1405.       tries to work around that problem */
  1406.        passlen2 = 0;
  1407.      }
  1408. +#endif
  1409.      p += passlen1 + passlen2;
  1410.      strcpy(user,p); p = skip_string(p,1);
  1411.      DEBUG(3,("Domain=[%s]  NativeOS=[%s] NativeLanMan=[%s]\n",
  1412. @@ -1179,7 +1181,9 @@
  1413.    if (sys_lstat(fname,&sbuf) != 0) return(False);
  1414.    fmode = dos_mode(cnum,fname,&sbuf);
  1415.    if (fmode & aDIR) return(False);
  1416. -  if (fmode & aRONLY) return(False);
  1417. +  if (!lp_delete_readonly(SNUM(cnum))) {
  1418. +    if (fmode & aRONLY) return(False);
  1419. +  }
  1420.    if ((fmode & ~dirtype) & (aHIDDEN | aSYSTEM))
  1421.      return(False);
  1422.    if (!check_file_sharing(cnum,fname)) return(False);
  1423. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/server.c samba-1.9.16alpha4/source/server.c
  1424. --- samba-1.9.16alpha3/source/server.c    Wed May 29 17:54:25 1996
  1425. +++ samba-1.9.16alpha4/source/server.c    Sat Jun  1 01:15:12 1996
  1426. @@ -2456,6 +2456,8 @@
  1427.  int find_free_file(void )
  1428.  {
  1429.    int i;
  1430. +  /* we start at 1 here for an obscure reason I can't now remember,
  1431. +     but I think is important :-) */
  1432.    for (i=1;i<MAX_OPEN_FILES;i++)
  1433.      if (!Files[i].open)
  1434.        return(i);
  1435. @@ -2626,6 +2628,7 @@
  1436.    int capabilities=0x300; /* has dual names + lock_and_read */
  1437.    int secword=0;
  1438.    BOOL doencrypt = SMBENCRYPT();
  1439. +  time_t t = time(NULL);
  1440.  
  1441.    if (lp_security()>=SEC_USER) secword |= 1;
  1442.    if (doencrypt) secword |= 2;
  1443. @@ -2660,8 +2663,8 @@
  1444.    SIVAL(outbuf,smb_vwv3+1,0xFFFF); /* max buffer */
  1445.    SIVAL(outbuf,smb_vwv5+1,0xFFFF); /* raw size */
  1446.    SIVAL(outbuf,smb_vwv9+1,capabilities); /* capabilities */
  1447. -  put_long_date(outbuf+smb_vwv11+1,time(NULL));
  1448. -  SSVALS(outbuf,smb_vwv15+1,TimeDiff(time(NULL))/60);
  1449. +  put_long_date(outbuf+smb_vwv11+1,t);
  1450. +  SSVALS(outbuf,smb_vwv15+1,TimeDiff(t)/60);
  1451.  
  1452.    return (smb_len(outbuf)+4);
  1453.  }
  1454. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/smb.h samba-1.9.16alpha4/source/smb.h
  1455. --- samba-1.9.16alpha3/source/smb.h    Sat May  4 17:50:24 1996
  1456. +++ samba-1.9.16alpha4/source/smb.h    Sat Jun  1 01:15:12 1996
  1457. @@ -624,7 +624,6 @@
  1458.  int get_share_mode(int cnum,struct stat *sbuf,int *pid);
  1459.  void del_share_mode(int fnum);
  1460.  BOOL set_share_mode(int fnum,int mode);
  1461. -int DSTDiff(time_t t);
  1462.  void TimeInit(void);
  1463.  void put_long_date(char *p,time_t t);
  1464.  time_t interpret_long_date(char *p);
  1465. @@ -822,14 +821,12 @@
  1466.  void close_cnum(int cnum,int uid);
  1467.  char *smb_errstr(char *inbuf);
  1468.  void GetTimeOfDay(struct timeval *tval);
  1469. -struct tm *LocalTime(time_t *t,int);
  1470. +struct tm *LocalTime(time_t *t);
  1471.  int TimeDiff(time_t t);
  1472.  BOOL set_filetime(char *fname,time_t mtime);
  1473.  char *dirname_dos(char *path,char *buf);
  1474.  BOOL get_myname(char *myname,struct in_addr *ip);
  1475.  void expand_mask(char *Mask, BOOL);
  1476. -BOOL sane_unix_date(time_t unixdate);
  1477. -time_t start_of_month(void);
  1478.  char *smb_fn_name(int cnum);
  1479.  void get_machine_info(void);
  1480.  int open_socket_in(int type, int port, int dlevel);
  1481. @@ -966,7 +963,8 @@
  1482.  enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER};
  1483.  
  1484.  /* printing types */
  1485. -enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX,PRINT_QNX};
  1486. +enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX,
  1487. +             PRINT_QNX,PRINT_PLP};
  1488.  
  1489.  
  1490.  /* case handling */
  1491. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/smbpasswd.c samba-1.9.16alpha4/source/smbpasswd.c
  1492. --- samba-1.9.16alpha3/source/smbpasswd.c    Wed May 29 17:54:25 1996
  1493. +++ samba-1.9.16alpha4/source/smbpasswd.c    Sat Jun  1 01:15:13 1996
  1494. @@ -232,6 +232,8 @@
  1495.    char           *pfile = SMB_PASSWD_FILE;
  1496.    char            readbuf[16 * 1024];
  1497.    
  1498. +  TimeInit();
  1499. +
  1500.    setup_logging(argv[0],True);
  1501.    
  1502.    charset_initialise();
  1503. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/status.c samba-1.9.16alpha4/source/status.c
  1504. --- samba-1.9.16alpha3/source/status.c    Mon May  6 10:35:46 1996
  1505. +++ samba-1.9.16alpha4/source/status.c    Sat Jun  1 01:15:13 1996
  1506. @@ -58,6 +58,7 @@
  1507.    BOOL processes_only=False;
  1508.    int last_pid=0;
  1509.  
  1510. +  TimeInit();
  1511.    setup_logging(argv[0],True);
  1512.  
  1513.    charset_initialise();
  1514. @@ -146,7 +147,7 @@
  1515.        printf("%-10.10s   %-8s %-8s %5d   %-8s (%s) %s",
  1516.           crec.name,uidtoname(crec.uid),gidtoname(crec.gid),crec.pid,
  1517.           crec.machine,crec.addr,
  1518. -         asctime(LocalTime(&crec.start,GMT_TO_LOCAL)));
  1519. +         asctime(LocalTime(&crec.start)));
  1520.        }
  1521.      }
  1522.    fclose(f);
  1523. @@ -217,7 +218,7 @@
  1524.        case 1: printf("WRONLY "); break;
  1525.        case 2: printf("RDWR   "); break;
  1526.        }
  1527. -    printf(" %s   %s",fname,asctime(LocalTime(&t,GMT_TO_LOCAL)));
  1528. +    printf(" %s   %s",fname,asctime(LocalTime(&t)));
  1529.    }
  1530.    closedir(dir);
  1531.  
  1532. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/testparm.c samba-1.9.16alpha4/source/testparm.c
  1533. --- samba-1.9.16alpha3/source/testparm.c    Sat May  4 17:50:25 1996
  1534. +++ samba-1.9.16alpha4/source/testparm.c    Sat Jun  1 01:15:13 1996
  1535. @@ -46,6 +46,8 @@
  1536.    pstring configfile;
  1537.    int s;
  1538.  
  1539. +  TimeInit();
  1540. +
  1541.    setup_logging(argv[0],True);
  1542.    
  1543.    charset_initialise();
  1544. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/testprns.c samba-1.9.16alpha4/source/testprns.c
  1545. --- samba-1.9.16alpha3/source/testprns.c    Sat May  4 17:50:25 1996
  1546. +++ samba-1.9.16alpha4/source/testprns.c    Sat Jun  1 01:15:13 1996
  1547. @@ -43,6 +43,8 @@
  1548.  {
  1549.     char *pszTemp;
  1550.  
  1551. +   TimeInit();
  1552. +
  1553.     setup_logging(argv[0],True);
  1554.  
  1555.     charset_initialise();
  1556. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/time.c samba-1.9.16alpha4/source/time.c
  1557. --- samba-1.9.16alpha3/source/time.c    Thu Jan  1 10:00:00 1970
  1558. +++ samba-1.9.16alpha4/source/time.c    Sat Jun  1 01:13:08 1996
  1559. @@ -0,0 +1,495 @@
  1560. +/* 
  1561. +   Unix SMB/Netbios implementation.
  1562. +   Version 1.9.
  1563. +   time handling functions
  1564. +   Copyright (C) Andrew Tridgell 1992-1995
  1565. +   
  1566. +   This program is free software; you can redistribute it and/or modify
  1567. +   it under the terms of the GNU General Public License as published by
  1568. +   the Free Software Foundation; either version 2 of the License, or
  1569. +   (at your option) any later version.
  1570. +   
  1571. +   This program is distributed in the hope that it will be useful,
  1572. +   but WITHOUT ANY WARRANTY; without even the implied warranty of
  1573. +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1574. +   GNU General Public License for more details.
  1575. +   
  1576. +   You should have received a copy of the GNU General Public License
  1577. +   along with this program; if not, write to the Free Software
  1578. +   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1579. +*/
  1580. +
  1581. +#include "includes.h"
  1582. +
  1583. +/*
  1584. +  This stuff was largely rewritten by Paul Eggert <eggert@twinsun.com>
  1585. +  in May 1996 
  1586. +  */
  1587. +
  1588. +
  1589. +int serverzone=0;
  1590. +int extra_time_offset = 0;
  1591. +
  1592. +extern int DEBUGLEVEL;
  1593. +
  1594. +#ifndef CHAR_BIT
  1595. +#define CHAR_BIT 8
  1596. +#endif
  1597. +
  1598. +#ifndef TIME_T_MIN
  1599. +#define TIME_T_MIN (0 < (time_t) -1 ? (time_t) 0 \
  1600. +            : ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1))
  1601. +#endif
  1602. +#ifndef TIME_T_MAX
  1603. +#define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN)
  1604. +#endif
  1605. +
  1606. +
  1607. +
  1608. +/*******************************************************************
  1609. +a gettimeofday wrapper
  1610. +********************************************************************/
  1611. +void GetTimeOfDay(struct timeval *tval)
  1612. +{
  1613. +#ifdef GETTIMEOFDAY1
  1614. +  gettimeofday(tval);
  1615. +#else
  1616. +  gettimeofday(tval,NULL);
  1617. +#endif
  1618. +}
  1619. +
  1620. +#define TM_YEAR_BASE 1900
  1621. +
  1622. +/*******************************************************************
  1623. +yield the difference between *A and *B, in seconds, ignoring leap seconds
  1624. +********************************************************************/
  1625. +static int tm_diff(struct tm *a, struct tm *b)
  1626. +{
  1627. +  int ay = a->tm_year + (TM_YEAR_BASE - 1);
  1628. +  int by = b->tm_year + (TM_YEAR_BASE - 1);
  1629. +  int intervening_leap_days =
  1630. +    (ay/4 - by/4) - (ay/100 - by/100) + (ay/400 - by/400);
  1631. +  int years = ay - by;
  1632. +  int days = 365*years + intervening_leap_days + (a->tm_yday - b->tm_yday);
  1633. +  int hours = 24*days + (a->tm_hour - b->tm_hour);
  1634. +  int minutes = 60*hours + (a->tm_min - b->tm_min);
  1635. +  int seconds = 60*minutes + (a->tm_sec - b->tm_sec);
  1636. +  return seconds;
  1637. +}
  1638. +
  1639. +/*******************************************************************
  1640. +  return the UTC offset in seconds west of UTC
  1641. +  ******************************************************************/
  1642. +static int TimeZone(time_t t)
  1643. +{
  1644. +  struct tm tm_utc = *(gmtime(&t));
  1645. +  return tm_diff(&tm_utc,localtime(&t));
  1646. +}
  1647. +
  1648. +
  1649. +/*******************************************************************
  1650. +init the time differences
  1651. +********************************************************************/
  1652. +void TimeInit(void)
  1653. +{
  1654. +  serverzone = TimeZone(time(NULL));
  1655. +  DEBUG(4,("Serverzone is %d\n",serverzone));
  1656. +}
  1657. +
  1658. +
  1659. +/*******************************************************************
  1660. +return the same value as TimeZone, but it should be more efficient.
  1661. +
  1662. +We keep a table of DST offsets to prevent calling localtime() on each 
  1663. +call of this function. This saves a LOT of time on many unixes.
  1664. +
  1665. +Updated by Paul Eggert <eggert@twinsun.com>
  1666. +********************************************************************/
  1667. +static int TimeZoneFaster(time_t t)
  1668. +{
  1669. +  static struct dst_table {time_t start,end; int zone;} *dst_table = NULL;
  1670. +  static int table_size = 0;
  1671. +  int i;
  1672. +  int zone = 0;
  1673. +
  1674. +  if (t == 0) t = time(NULL);
  1675. +
  1676. +  /* Tunis has a 8 day DST region, we need to be careful ... */
  1677. +#define MAX_DST_WIDTH (365*24*60*60)
  1678. +#define MAX_DST_SKIP (7*24*60*60)
  1679. +
  1680. +  for (i=0;i<table_size;i++)
  1681. +    if (t >= dst_table[i].start && t <= dst_table[i].end) break;
  1682. +
  1683. +  if (i<table_size) {
  1684. +    zone = dst_table[i].zone;
  1685. +  } else {
  1686. +    time_t low,high;
  1687. +
  1688. +    zone = TimeZone(t);
  1689. +    dst_table = (struct dst_table *)Realloc(dst_table,
  1690. +                          sizeof(dst_table[0])*(i+1));
  1691. +    if (!dst_table) {
  1692. +      table_size = 0;
  1693. +    } else {
  1694. +      table_size++;
  1695. +
  1696. +      dst_table[i].zone = zone; 
  1697. +      dst_table[i].start = dst_table[i].end = t;
  1698. +    
  1699. +      /* no entry will cover more than 6 months */
  1700. +      low = t - MAX_DST_WIDTH/2;
  1701. +      if (t < low)
  1702. +    low = TIME_T_MIN;
  1703. +      
  1704. +      /* widen the new entry using two bisection searches */
  1705. +      while (low+60*60 < dst_table[i].start) {
  1706. +    if (dst_table[i].start - low > MAX_DST_SKIP*2)
  1707. +      t = dst_table[i].start - MAX_DST_SKIP;
  1708. +    else
  1709. +      t = low + (dst_table[i].start-low)/2;
  1710. +    if (TimeZone(t) == zone)
  1711. +      dst_table[i].start = t;
  1712. +    else
  1713. +      low = t;
  1714. +      }
  1715. +
  1716. +      high = low + MAX_DST_WIDTH/2;
  1717. +      if (high < t)
  1718. +    high = TIME_T_MAX;
  1719. +      
  1720. +      while (high-60*60 > dst_table[i].end) {
  1721. +    if (high - dst_table[i].end > MAX_DST_SKIP*2)
  1722. +      t = dst_table[i].end + MAX_DST_SKIP;
  1723. +    else
  1724. +      t = high - (high-dst_table[i].end)/2;
  1725. +    if (TimeZone(t) == zone)
  1726. +      dst_table[i].end = t;
  1727. +    else
  1728. +      high = t;
  1729. +      }
  1730. +#if 0
  1731. +      DEBUG(1,("Added DST entry from %s ",
  1732. +           asctime(localtime(&dst_table[i].start))));
  1733. +      DEBUG(1,("to %s (%d)\n",asctime(localtime(&dst_table[i].end)),
  1734. +           dst_table[i].zone));
  1735. +#endif
  1736. +    }
  1737. +  }
  1738. +  return zone;
  1739. +}
  1740. +
  1741. +/****************************************************************************
  1742. +  return the UTC offset in seconds west of UTC, adjusted for extra time offset
  1743. +  **************************************************************************/
  1744. +int TimeDiff(time_t t)
  1745. +{
  1746. +  return TimeZoneFaster(t) + 60*extra_time_offset;
  1747. +}
  1748. +
  1749. +
  1750. +/****************************************************************************
  1751. +  return the UTC offset in seconds west of UTC, adjusted for extra time
  1752. +  offset, for a local time value.  If ut = lt + LocTimeDiff(lt), then
  1753. +  lt = ut - TimeDiff(ut), but the converse does not necessarily hold near
  1754. +  daylight savings transitions because some local times are ambiguous.
  1755. +  LocTimeDiff(t) equals TimeDiff(t) except near daylight savings transitions.
  1756. +  +**************************************************************************/
  1757. +static int LocTimeDiff(time_t lte)
  1758. +{
  1759. +  time_t lt = lte - 60*extra_time_offset;
  1760. +  int d = TimeZoneFaster(lt);
  1761. +  time_t t = lt + d;
  1762. +
  1763. +  /* if overflow occurred, ignore all the adjustments so far */
  1764. +  if (((lte < lt) ^ (extra_time_offset < 0))  |  ((t < lt) ^ (d < 0)))
  1765. +    t = lte;
  1766. +
  1767. +  /* now t should be close enough to the true UTC to yield the right answer */
  1768. +  return TimeDiff(t);
  1769. +}
  1770. +
  1771. +
  1772. +/****************************************************************************
  1773. +try to optimise the localtime call, it can be quite expenive on some machines
  1774. +****************************************************************************/
  1775. +struct tm *LocalTime(time_t *t)
  1776. +{
  1777. +  time_t t2 = *t;
  1778. +
  1779. +  t2 -= TimeDiff(t2);
  1780. +
  1781. +  return(gmtime(&t2));
  1782. +}
  1783. +
  1784. +
  1785. +#define TIME_FIXUP_CONSTANT (369.0*365.25*24*60*60-(3.0*24*60*60+6.0*60*60))
  1786. +
  1787. +/****************************************************************************
  1788. +interpret an 8 byte "filetime" structure to a time_t
  1789. +It's originally in "100ns units since jan 1st 1601"
  1790. +
  1791. +It appears to be kludge-GMT (at least for file listings). This means
  1792. +its the GMT you get by taking a localtime and adding the
  1793. +serverzone. This is NOT the same as GMT in some cases. This routine
  1794. +converts this to real GMT.
  1795. +****************************************************************************/
  1796. +time_t interpret_long_date(char *p)
  1797. +{
  1798. +  double d;
  1799. +  time_t ret;
  1800. +  uint32 tlow,thigh;
  1801. +  tlow = IVAL(p,0);
  1802. +  thigh = IVAL(p,4);
  1803. +
  1804. +  if (thigh == 0) return(0);
  1805. +
  1806. +  d = ((double)thigh)*4.0*(double)(1<<30);
  1807. +  d += (tlow&0xFFF00000);
  1808. +  d *= 1.0e-7;
  1809. +  /* now adjust by 369 years to make the secs since 1970 */
  1810. +  d -= TIME_FIXUP_CONSTANT;
  1811. +
  1812. +  if (!(TIME_T_MIN <= d && d <= TIME_T_MAX))
  1813. +    return(0);
  1814. +
  1815. +  ret = (time_t)(d+0.5);
  1816. +
  1817. +  /* this takes us from kludge-GMT to real GMT */
  1818. +  ret -= serverzone;
  1819. +  ret += LocTimeDiff(ret);
  1820. +
  1821. +  return(ret);
  1822. +}
  1823. +
  1824. +
  1825. +/****************************************************************************
  1826. +put a 8 byte filetime from a time_t
  1827. +This takes real GMT as input and converts to kludge-GMT
  1828. +****************************************************************************/
  1829. +void put_long_date(char *p,time_t t)
  1830. +{
  1831. +  uint32 tlow,thigh;
  1832. +  double d;
  1833. +
  1834. +  if (t==0) {
  1835. +    SIVAL(p,0,0); SIVAL(p,4,0);
  1836. +    return;
  1837. +  }
  1838. +
  1839. +  /* this converts GMT to kludge-GMT */
  1840. +  t -= TimeDiff(t) - serverzone; 
  1841. +
  1842. +  d = (double) (t);
  1843. +
  1844. +  d += TIME_FIXUP_CONSTANT;
  1845. +
  1846. +  d *= 1.0e7;
  1847. +
  1848. +  thigh = (uint32)(d * (1.0/(4.0*(double)(1<<30))));
  1849. +  tlow = (uint32)(d - ((double)thigh)*4.0*(double)(1<<30));
  1850. +
  1851. +  SIVAL(p,0,tlow);
  1852. +  SIVAL(p,4,thigh);
  1853. +}
  1854. +
  1855. +
  1856. +/****************************************************************************
  1857. +check if it's a null mtime
  1858. +****************************************************************************/
  1859. +static BOOL null_mtime(time_t mtime)
  1860. +{
  1861. +  if (mtime == 0 || mtime == 0xFFFFFFFF || mtime == (time_t)-1)
  1862. +    return(True);
  1863. +  return(False);
  1864. +}
  1865. +
  1866. +/*******************************************************************
  1867. +  create a 16 bit dos packed date
  1868. +********************************************************************/
  1869. +static uint16 make_dos_date1(time_t unixdate,struct tm *t)
  1870. +{
  1871. +  uint16 ret=0;
  1872. +  ret = (((unsigned)(t->tm_mon+1)) >> 3) | ((t->tm_year-80) << 1);
  1873. +  ret = ((ret&0xFF)<<8) | (t->tm_mday | (((t->tm_mon+1) & 0x7) << 5));
  1874. +  return(ret);
  1875. +}
  1876. +
  1877. +/*******************************************************************
  1878. +  create a 16 bit dos packed time
  1879. +********************************************************************/
  1880. +static uint16 make_dos_time1(time_t unixdate,struct tm *t)
  1881. +{
  1882. +  uint16 ret=0;
  1883. +  ret = ((((unsigned)t->tm_min >> 3)&0x7) | (((unsigned)t->tm_hour) << 3));
  1884. +  ret = ((ret&0xFF)<<8) | ((t->tm_sec/2) | ((t->tm_min & 0x7) << 5));
  1885. +  return(ret);
  1886. +}
  1887. +
  1888. +/*******************************************************************
  1889. +  create a 32 bit dos packed date/time from some parameters
  1890. +  This takes a GMT time and returns a packed localtime structure
  1891. +********************************************************************/
  1892. +static uint32 make_dos_date(time_t unixdate)
  1893. +{
  1894. +  struct tm *t;
  1895. +  uint32 ret=0;
  1896. +
  1897. +  t = LocalTime(&unixdate);
  1898. +
  1899. +  ret = make_dos_date1(unixdate,t);
  1900. +  ret = ((ret&0xFFFF)<<16) | make_dos_time1(unixdate,t);
  1901. +
  1902. +  return(ret);
  1903. +}
  1904. +
  1905. +/*******************************************************************
  1906. +put a dos date into a buffer (time/date format)
  1907. +This takes GMT time and puts local time in the buffer
  1908. +********************************************************************/
  1909. +void put_dos_date(char *buf,int offset,time_t unixdate)
  1910. +{
  1911. +  uint32 x = make_dos_date(unixdate);
  1912. +  SIVAL(buf,offset,x);
  1913. +}
  1914. +
  1915. +/*******************************************************************
  1916. +put a dos date into a buffer (date/time format)
  1917. +This takes GMT time and puts local time in the buffer
  1918. +********************************************************************/
  1919. +void put_dos_date2(char *buf,int offset,time_t unixdate)
  1920. +{
  1921. +  uint32 x = make_dos_date(unixdate);
  1922. +  x = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16);
  1923. +  SIVAL(buf,offset,x);
  1924. +}
  1925. +
  1926. +/*******************************************************************
  1927. +put a dos 32 bit "unix like" date into a buffer. This routine takes
  1928. +GMT and converts it to LOCAL time before putting it (most SMBs assume
  1929. +localtime for this sort of date)
  1930. +********************************************************************/
  1931. +void put_dos_date3(char *buf,int offset,time_t unixdate)
  1932. +{
  1933. +  if (!null_mtime(unixdate))
  1934. +    unixdate -= TimeDiff(unixdate);
  1935. +  SIVAL(buf,offset,unixdate);
  1936. +}
  1937. +
  1938. +/*******************************************************************
  1939. +  interpret a 32 bit dos packed date/time to some parameters
  1940. +********************************************************************/
  1941. +static void interpret_dos_date(uint32 date,int *year,int *month,int *day,int *hour,int *minute,int *second)
  1942. +{
  1943. +  uint32 p0,p1,p2,p3;
  1944. +
  1945. +  p0=date&0xFF; p1=((date&0xFF00)>>8)&0xFF; 
  1946. +  p2=((date&0xFF0000)>>16)&0xFF; p3=((date&0xFF000000)>>24)&0xFF;
  1947. +
  1948. +  *second = 2*(p0 & 0x1F);
  1949. +  *minute = ((p0>>5)&0xFF) + ((p1&0x7)<<3);
  1950. +  *hour = (p1>>3)&0xFF;
  1951. +  *day = (p2&0x1F);
  1952. +  *month = ((p2>>5)&0xFF) + ((p3&0x1)<<3) - 1;
  1953. +  *year = ((p3>>1)&0xFF) + 80;
  1954. +}
  1955. +
  1956. +/*******************************************************************
  1957. +  create a unix date (int GMT) from a dos date (which is actually in
  1958. +  localtime)
  1959. +********************************************************************/
  1960. +time_t make_unix_date(void *date_ptr)
  1961. +{
  1962. +  uint32 dos_date=0;
  1963. +  struct tm t;
  1964. +  time_t ret;
  1965. +
  1966. +  dos_date = IVAL(date_ptr,0);
  1967. +
  1968. +  if (dos_date == 0) return(0);
  1969. +  
  1970. +  interpret_dos_date(dos_date,&t.tm_year,&t.tm_mon,
  1971. +             &t.tm_mday,&t.tm_hour,&t.tm_min,&t.tm_sec);
  1972. +  t.tm_isdst = -1;
  1973. +  
  1974. +  /* mktime() also does the local to GMT time conversion for us */
  1975. +  ret = mktime(&t);
  1976. +
  1977. +  return(ret);
  1978. +}
  1979. +
  1980. +/*******************************************************************
  1981. +like make_unix_date() but the words are reversed
  1982. +********************************************************************/
  1983. +time_t make_unix_date2(void *date_ptr)
  1984. +{
  1985. +  uint32 x,x2;
  1986. +
  1987. +  x = IVAL(date_ptr,0);
  1988. +  x2 = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16);
  1989. +  SIVAL(&x,0,x2);
  1990. +
  1991. +  return(make_unix_date((void *)&x));
  1992. +}
  1993. +
  1994. +/*******************************************************************
  1995. +  create a unix GMT date from a dos date in 32 bit "unix like" format
  1996. +  these generally arrive as localtimes, with corresponding DST
  1997. +  ******************************************************************/
  1998. +time_t make_unix_date3(void *date_ptr)
  1999. +{
  2000. +  time_t t = IVAL(date_ptr,0);
  2001. +  if (!null_mtime(t))
  2002. +    t += LocTimeDiff(t);
  2003. +  return(t);
  2004. +}
  2005. +
  2006. +/****************************************************************************
  2007. +set the time on a file
  2008. +****************************************************************************/
  2009. +BOOL set_filetime(char *fname,time_t mtime)
  2010. +{  
  2011. +  struct utimbuf times;
  2012. +
  2013. +  if (null_mtime(mtime)) return(True);
  2014. +
  2015. +  times.modtime = times.actime = mtime;
  2016. +
  2017. +  if (sys_utime(fname,×)) {
  2018. +    DEBUG(4,("set_filetime(%s) failed: %s\n",fname,strerror(errno)));
  2019. +  }
  2020. +    
  2021. +  return(True);
  2022. +}
  2023. +
  2024. +
  2025. +/****************************************************************************
  2026. +  return the date and time as a string
  2027. +****************************************************************************/
  2028. +char *timestring(void )
  2029. +{
  2030. +  static char TimeBuf[100];
  2031. +  time_t t = time(NULL);
  2032. +  struct tm *tm = LocalTime(&t);
  2033. +
  2034. +#ifdef NO_STRFTIME
  2035. +  strcpy(TimeBuf, asctime(tm));
  2036. +#elif defined(CLIX) || defined(CONVEX)
  2037. +  strftime(TimeBuf,100,"%m/%d/%y %I:%M:%S %p",tm);
  2038. +#elif defined(AMPM)
  2039. +  strftime(TimeBuf,100,"%D %r",tm);
  2040. +#elif defined(TZ_TIME)
  2041. +  {
  2042. +    int zone = TimeDiff(t);
  2043. +    int absZoneMinutes = (zone<0 ? -zone : zone) / 60;
  2044. +    size_t len = strftime(TimeBuf,sizeof(TimeBuf)-6,"%D %T",tm);
  2045. +    sprintf(TimeBuf+len," %c%02d%02d",
  2046. +        zone<0?'+':'-',absZoneMinutes/60,absZoneMinutes%60);
  2047. +  }
  2048. +#else
  2049. +  strftime(TimeBuf,100,"%D %T",tm);
  2050. +#endif
  2051. +  return(TimeBuf);
  2052. +}
  2053. +
  2054. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/util.c samba-1.9.16alpha4/source/util.c
  2055. --- samba-1.9.16alpha3/source/util.c    Wed May 29 17:54:27 1996
  2056. +++ samba-1.9.16alpha4/source/util.c    Sat Jun  1 01:15:13 1996
  2057. @@ -30,8 +30,6 @@
  2058.  
  2059.  int Protocol = PROTOCOL_COREPLUS;
  2060.  
  2061. -int serverzone=0;
  2062. -
  2063.  /* a default finfo structure to ensure all fields are sensible */
  2064.  file_info def_finfo = {-1,0,0,0,0,0,0,""};
  2065.  
  2066. @@ -407,141 +405,6 @@
  2067.    close(fd);
  2068.  }
  2069.  
  2070. -/*******************************************************************
  2071. -a gettimeofday wrapper
  2072. -********************************************************************/
  2073. -void GetTimeOfDay(struct timeval *tval)
  2074. -{
  2075. -#ifdef GETTIMEOFDAY1
  2076. -  gettimeofday(tval);
  2077. -#else
  2078. -  gettimeofday(tval,NULL);
  2079. -#endif
  2080. -}
  2081. -
  2082. -int extra_time_offset = 0;
  2083. -
  2084. -static int timediff = 0;
  2085. -
  2086. -/*******************************************************************
  2087. -init the time differences
  2088. -********************************************************************/
  2089. -void TimeInit(void)
  2090. -{
  2091. -  struct tm tm_utc,tm_local;
  2092. -  time_t t;
  2093. -
  2094. -  t = time(NULL);
  2095. -
  2096. -  tm_utc = *(gmtime(&t));
  2097. -  tm_local = *(localtime(&t));
  2098. -
  2099. -#ifdef HAVE_GMTOFF
  2100. -  timediff = -tm_local.tm_gmtoff;  
  2101. -#else
  2102. -  timediff = mktime(&tm_utc) - mktime(&tm_local);
  2103. -#endif
  2104. -
  2105. -  if (serverzone == 0) {
  2106. -    serverzone = timediff - DSTDiff(t);
  2107. -    DEBUG(4,("Serverzone is %d\n",serverzone));
  2108. -  }
  2109. -}
  2110. -
  2111. -
  2112. -/*******************************************************************
  2113. -return the DST offset for a particular time
  2114. -We keep a table of DST offsets to prevent calling localtime() on each 
  2115. -call of this function. This saves a LOT of time on many unixes.
  2116. -********************************************************************/
  2117. -int DSTDiff(time_t t)
  2118. -{
  2119. -  static struct dst_table {time_t start,end; BOOL is_dst;} *dst_table = NULL;
  2120. -  static int table_size = 0;
  2121. -  int i;
  2122. -  BOOL is_dst = False;
  2123. -
  2124. -  if (t == 0) t = time(NULL);
  2125. -
  2126. -#ifndef NO_ISDST
  2127. -  for (i=0;i<table_size;i++)
  2128. -    if (t >= dst_table[i].start && t <= dst_table[i].end) break;
  2129. -
  2130. -  if (i<table_size) {
  2131. -    is_dst = dst_table[i].is_dst;
  2132. -  } else {
  2133. -    time_t low,high;
  2134. -
  2135. -    dst_table = (struct dst_table *)Realloc(dst_table,
  2136. -                          sizeof(dst_table[0])*(i+1));
  2137. -    if (!dst_table) {
  2138. -      table_size = 0;
  2139. -      return(0);
  2140. -    }
  2141. -
  2142. -    table_size++;
  2143. -
  2144. -    dst_table[i].is_dst = is_dst = (localtime(&t)->tm_isdst?True:False);
  2145. -    dst_table[i].start = dst_table[i].end = t;
  2146. -    
  2147. -    /* no entry will cover more than 6 months */
  2148. -    low = t - 3*30*24*60*60;
  2149. -
  2150. -    /* widen the new entry using two bisection searches */
  2151. -    while (low+60*60 < dst_table[i].start) {
  2152. -      t = low + (dst_table[i].start-low)/2;
  2153. -      if ((localtime(&t)->tm_isdst?True:False) == is_dst)
  2154. -    dst_table[i].start = t;
  2155. -      else
  2156. -    low = t;
  2157. -    }
  2158. -
  2159. -    high = low + 3*30*24*60*60;
  2160. -    while (high-60*60 > dst_table[i].end) {
  2161. -      t = high - (high-dst_table[i].end)/2;
  2162. -      if ((localtime(&t)->tm_isdst?True:False) == is_dst)
  2163. -    dst_table[i].end = t;
  2164. -      else
  2165. -    high = t;
  2166. -    }    
  2167. -
  2168. -/*
  2169. -    DEBUG(1,("Added DST entry from %s ",
  2170. -         asctime(localtime(&dst_table[i].start))));
  2171. -    DEBUG(1,("to %s (%d)\n",asctime(localtime(&dst_table[i].end)),
  2172. -         dst_table[i].is_dst));
  2173. -*/
  2174. -  }
  2175. -#endif
  2176. -
  2177. -  return((is_dst?60*60:0) - (extra_time_offset*60));
  2178. -}
  2179. -
  2180. -/****************************************************************************
  2181. -return the difference between local and GMT time
  2182. -****************************************************************************/
  2183. -int TimeDiff(time_t t)
  2184. -{
  2185. -  static BOOL initialised = False;
  2186. -  if (!initialised) {initialised=True; TimeInit();}
  2187. -  return(timediff - DSTDiff(t));
  2188. -}
  2189. -
  2190. -/****************************************************************************
  2191. -try to optimise the localtime call, it can be quite expenive on some machines
  2192. -timemul is normally LOCAL_TO_GMT, GMT_TO_LOCAL or 0
  2193. -****************************************************************************/
  2194. -struct tm *LocalTime(time_t *t,int timemul)
  2195. -{
  2196. -  time_t t2 = *t;
  2197. -
  2198. -  if (timemul)
  2199. -    t2 += timemul * TimeDiff(t2);
  2200. -
  2201. -  return(gmtime(&t2));
  2202. -}
  2203. -
  2204. -
  2205.  /****************************************************************************
  2206.  determine if a file descriptor is in fact a socket
  2207.  ****************************************************************************/
  2208. @@ -822,32 +685,6 @@
  2209.  }
  2210.  
  2211.  /****************************************************************************
  2212. -  return the date and time as a string
  2213. -****************************************************************************/
  2214. -char *timestring(void )
  2215. -{
  2216. -  static char TimeBuf[100];
  2217. -  time_t t;
  2218. -  t = time(NULL);
  2219. -#ifdef NO_STRFTIME
  2220. -  strcpy(TimeBuf, asctime(LocalTime(&t,GMT_TO_LOCAL)));
  2221. -#elif defined(CLIX) || defined(CONVEX)
  2222. -  strftime(TimeBuf,100,"%m/%d/%y %I:%M:%S %p",LocalTime(&t,GMT_TO_LOCAL));
  2223. -#elif defined(AMPM)
  2224. -  strftime(TimeBuf,100,"%D %r",LocalTime(&t,GMT_TO_LOCAL));
  2225. -#elif defined(TZ_TIME)
  2226. -  {
  2227. -    strftime(TimeBuf,100,"%D:%T",LocalTime(&t,0));
  2228. -    sprintf(TimeBuf+strlen(TimeBuf)," %+03d%02d",
  2229. -        -TimeDiff(t)/(60*60),-(TimeDiff(t)/60)%60);
  2230. -  }
  2231. -#else
  2232. -  strftime(TimeBuf,100,"%D %T",LocalTime(&t,GMT_TO_LOCAL));
  2233. -#endif
  2234. -  return(TimeBuf);
  2235. -}
  2236. -
  2237. -/****************************************************************************
  2238.  determine whether we are in the specified group
  2239.  ****************************************************************************/
  2240.  BOOL in_group(gid_t group, int current_gid, int ngroups, int *groups)
  2241. @@ -1050,159 +887,6 @@
  2242.    return(buf.st_size);
  2243.  }
  2244.  
  2245. -/****************************************************************************
  2246. -check if it's a null mtime
  2247. -****************************************************************************/
  2248. -static BOOL null_mtime(time_t mtime)
  2249. -{
  2250. -  if (mtime == 0 || mtime == 0xFFFFFFFF)
  2251. -    return(True);
  2252. -  return(False);
  2253. -}
  2254. -
  2255. -/*******************************************************************
  2256. -  create a 16 bit dos packed date
  2257. -********************************************************************/
  2258. -static uint16 make_dos_date1(time_t unixdate,struct tm *t)
  2259. -{
  2260. -  uint16 ret=0;
  2261. -  ret = (((unsigned)(t->tm_mon+1)) >> 3) | ((t->tm_year-80) << 1);
  2262. -  ret = ((ret&0xFF)<<8) | (t->tm_mday | (((t->tm_mon+1) & 0x7) << 5));
  2263. -  return(ret);
  2264. -}
  2265. -
  2266. -/*******************************************************************
  2267. -  create a 16 bit dos packed time
  2268. -********************************************************************/
  2269. -static uint16 make_dos_time1(time_t unixdate,struct tm *t)
  2270. -{
  2271. -  uint16 ret=0;
  2272. -  ret = ((((unsigned)t->tm_min >> 3)&0x7) | (((unsigned)t->tm_hour) << 3));
  2273. -  ret = ((ret&0xFF)<<8) | ((t->tm_sec/2) | ((t->tm_min & 0x7) << 5));
  2274. -  return(ret);
  2275. -}
  2276. -
  2277. -/*******************************************************************
  2278. -  create a 32 bit dos packed date/time from some parameters
  2279. -  This takes a GMT time and returns a packed localtime structure
  2280. -********************************************************************/
  2281. -static uint32 make_dos_date(time_t unixdate)
  2282. -{
  2283. -  struct tm *t;
  2284. -  uint32 ret=0;
  2285. -
  2286. -  t = LocalTime(&unixdate,GMT_TO_LOCAL);
  2287. -
  2288. -  ret = make_dos_date1(unixdate,t);
  2289. -  ret = ((ret&0xFFFF)<<16) | make_dos_time1(unixdate,t);
  2290. -
  2291. -  return(ret);
  2292. -}
  2293. -
  2294. -/*******************************************************************
  2295. -put a dos date into a buffer (time/date format)
  2296. -This takes GMT time and puts local time in the buffer
  2297. -********************************************************************/
  2298. -void put_dos_date(char *buf,int offset,time_t unixdate)
  2299. -{
  2300. -  uint32 x = make_dos_date(unixdate);
  2301. -  SIVAL(buf,offset,x);
  2302. -}
  2303. -
  2304. -/*******************************************************************
  2305. -put a dos date into a buffer (date/time format)
  2306. -This takes GMT time and puts local time in the buffer
  2307. -********************************************************************/
  2308. -void put_dos_date2(char *buf,int offset,time_t unixdate)
  2309. -{
  2310. -  uint32 x = make_dos_date(unixdate);
  2311. -  x = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16);
  2312. -  SIVAL(buf,offset,x);
  2313. -}
  2314. -
  2315. -/*******************************************************************
  2316. -put a dos 32 bit "unix like" date into a buffer. This routine takes
  2317. -GMT and converts it to LOCAL time before putting it (most SMBs assume
  2318. -localtime for this sort of date)
  2319. -********************************************************************/
  2320. -void put_dos_date3(char *buf,int offset,time_t unixdate)
  2321. -{
  2322. -  if (!null_mtime(unixdate))
  2323. -    unixdate += GMT_TO_LOCAL*TimeDiff(unixdate);
  2324. -  SIVAL(buf,offset,unixdate);
  2325. -}
  2326. -
  2327. -/*******************************************************************
  2328. -  interpret a 32 bit dos packed date/time to some parameters
  2329. -********************************************************************/
  2330. -static void interpret_dos_date(uint32 date,int *year,int *month,int *day,int *hour,int *minute,int *second)
  2331. -{
  2332. -  uint32 p0,p1,p2,p3;
  2333. -
  2334. -  p0=date&0xFF; p1=((date&0xFF00)>>8)&0xFF; 
  2335. -  p2=((date&0xFF0000)>>16)&0xFF; p3=((date&0xFF000000)>>24)&0xFF;
  2336. -
  2337. -  *second = 2*(p0 & 0x1F);
  2338. -  *minute = ((p0>>5)&0xFF) + ((p1&0x7)<<3);
  2339. -  *hour = (p1>>3)&0xFF;
  2340. -  *day = (p2&0x1F);
  2341. -  *month = ((p2>>5)&0xFF) + ((p3&0x1)<<3) - 1;
  2342. -  *year = ((p3>>1)&0xFF) + 80;
  2343. -}
  2344. -
  2345. -/*******************************************************************
  2346. -  create a unix date (int GMT) from a dos date (which is actually in
  2347. -  localtime)
  2348. -********************************************************************/
  2349. -time_t make_unix_date(void *date_ptr)
  2350. -{
  2351. -  uint32 dos_date=0;
  2352. -  struct tm t;
  2353. -  time_t ret;
  2354. -
  2355. -  dos_date = IVAL(date_ptr,0);
  2356. -
  2357. -  if (dos_date == 0) return(0);
  2358. -  
  2359. -  interpret_dos_date(dos_date,&t.tm_year,&t.tm_mon,
  2360. -             &t.tm_mday,&t.tm_hour,&t.tm_min,&t.tm_sec);
  2361. -  t.tm_wday = 1;
  2362. -  t.tm_yday = 1;
  2363. -  t.tm_isdst = -1;
  2364. -  
  2365. -  /* mktime() also does the local to GMT time conversion for us. XXXXX
  2366. -     Do all unixes do this the same?? */
  2367. -  ret = mktime(&t);
  2368. -
  2369. -  return(ret);
  2370. -}
  2371. -
  2372. -/*******************************************************************
  2373. -like make_unix_date() but the words are reversed
  2374. -********************************************************************/
  2375. -time_t make_unix_date2(void *date_ptr)
  2376. -{
  2377. -  uint32 x,x2;
  2378. -
  2379. -  x = IVAL(date_ptr,0);
  2380. -  x2 = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16);
  2381. -  SIVAL(&x,0,x2);
  2382. -
  2383. -  return(make_unix_date((void *)&x));
  2384. -}
  2385. -
  2386. -/*******************************************************************
  2387. -  create a unix GMT date from a dos date in 32 bit "unix like" format
  2388. -these generally arrive as localtimes, with corresponding DST
  2389. -********************************************************************/
  2390. -time_t make_unix_date3(void *date_ptr)
  2391. -{
  2392. -  time_t t = IVAL(date_ptr,0);
  2393. -  if (!null_mtime(t))
  2394. -    t += LOCAL_TO_GMT*TimeDiff(t);
  2395. -  return(t);
  2396. -}
  2397. -
  2398.  /*******************************************************************
  2399.  return a string representing an attribute for a file
  2400.  ********************************************************************/
  2401. @@ -3528,6 +3212,13 @@
  2402.  void *Realloc(void *p,int size)
  2403.  {
  2404.    void *ret=NULL;
  2405. +
  2406. +  if (size == 0) {
  2407. +    if (p) free(p);
  2408. +    DEBUG(5,("Realloc asked for 0 bytes\n"));
  2409. +    return NULL;
  2410. +  }
  2411. +
  2412.    if (!p)
  2413.      ret = (void *)malloc(size);
  2414.    else
  2415. @@ -3539,25 +3230,6 @@
  2416.    return(ret);
  2417.  }
  2418.  
  2419. -/****************************************************************************
  2420. -set the time on a file
  2421. -****************************************************************************/
  2422. -BOOL set_filetime(char *fname,time_t mtime)
  2423. -{  
  2424. -  struct utimbuf times;
  2425. -
  2426. -  if (null_mtime(mtime)) return(True);
  2427. -
  2428. -  times.modtime = times.actime = mtime;
  2429. -
  2430. -  if (sys_utime(fname,×)) {
  2431. -    DEBUG(4,("set_filetime(%s) failed: %s\n",fname,strerror(errno)));
  2432. -  }
  2433. -    
  2434. -  return(True);
  2435. -}
  2436. -
  2437. -
  2438.  #ifdef NOSTRDUP
  2439.  /****************************************************************************
  2440.  duplicate a string
  2441. @@ -3598,57 +3270,6 @@
  2442.  #endif
  2443.  
  2444.  
  2445. -/****************************************************************************
  2446. -return a time at the start of the current month
  2447. -****************************************************************************/
  2448. -time_t start_of_month(void)
  2449. -{
  2450. -  time_t t = time(NULL);
  2451. -  struct tm *t2;
  2452. -  
  2453. -  t2 = gmtime(&t);
  2454. -  
  2455. -  t2->tm_mday = 1;
  2456. -  t2->tm_hour = 0;
  2457. -  t2->tm_min = 0;
  2458. -  t2->tm_sec = 0;
  2459. -  
  2460. -  return(mktime(t2));
  2461. -}
  2462. -
  2463. -
  2464. -/*******************************************************************
  2465. -  check for a sane unix date
  2466. -********************************************************************/
  2467. -BOOL sane_unix_date(time_t unixdate)
  2468. -{
  2469. -  struct tm t,today;
  2470. -  time_t t_today = time(NULL);
  2471. -  
  2472. -  t = *(LocalTime(&unixdate,LOCAL_TO_GMT));
  2473. -  today = *(LocalTime(&t_today,LOCAL_TO_GMT));
  2474. -  
  2475. -  if (t.tm_year < 80)
  2476. -    return(False);
  2477. -  
  2478. -  if (t.tm_year >  today.tm_year)
  2479. -    return(False);
  2480. -  
  2481. -  if (t.tm_year == today.tm_year &&
  2482. -      t.tm_mon > today.tm_mon)
  2483. -    return(False);
  2484. -  
  2485. -  
  2486. -  if (t.tm_year == today.tm_year &&
  2487. -      t.tm_mon == today.tm_mon &&
  2488. -      t.tm_mday > (today.tm_mday+1))
  2489. -    return(False);
  2490. -  
  2491. -  return(True);
  2492. -}
  2493. -
  2494. -
  2495. -
  2496.  #ifdef NO_FTRUNCATE
  2497.   /*******************************************************************
  2498.  ftruncate for operating systems that don't have it
  2499. @@ -3730,11 +3351,7 @@
  2500.    int res;
  2501.  
  2502.    /* get my host name */
  2503. -#ifdef MAXHOSTNAMELEN
  2504.    if (gethostname(host_name, MAXHOSTNAMELEN) == -1) 
  2505. -#else
  2506. -  if (gethostname(host_name, sizeof(host_name)) == -1) 
  2507. -#endif
  2508.      { DEBUG(0,("gethostname failed\n")); return -1; } 
  2509.  
  2510.    /* get host info */
  2511. @@ -3907,76 +3524,6 @@
  2512.    unsigned long a;
  2513.    putip((char *)&a,(char *)&ip);
  2514.    return(a == 0);
  2515. -}
  2516. -
  2517. -#define TIME_FIXUP_CONSTANT (369.0*365.25*24*60*60-(3.0*24*60*60+6.0*60*60))
  2518. -
  2519. -/****************************************************************************
  2520. -interpret an 8 byte "filetime" structure to a time_t
  2521. -It's originally in "100ns units since jan 1st 1601"
  2522. -
  2523. -It appears to be kludge-GMT (at least for file listings). This means
  2524. -its the GMT you get by taking a localtime and adding the
  2525. -serverzone. This is NOT the same as GMT in some cases. This routine
  2526. -converts this to real GMT.
  2527. -****************************************************************************/
  2528. -time_t interpret_long_date(char *p)
  2529. -{
  2530. -  double d;
  2531. -  time_t ret;
  2532. -  uint32 tlow,thigh;
  2533. -  tlow = IVAL(p,0);
  2534. -  thigh = IVAL(p,4);
  2535. -
  2536. -  if (thigh == 0) return(0);
  2537. -
  2538. -  d = ((double)thigh)*4.0*(double)(1<<30);
  2539. -  d += (tlow&0xFFF00000);
  2540. -  d *= 1.0e-7;
  2541. -  /* now adjust by 369 years to make the secs since 1970 */
  2542. -  d -= TIME_FIXUP_CONSTANT;
  2543. -
  2544. -  if (d>=MAXINT)
  2545. -    return(0);
  2546. -
  2547. -  ret = (time_t)(d+0.5);
  2548. -
  2549. -  /* this takes us from kludge-GMT to real GMT */
  2550. -  ret += TimeDiff(ret) - serverzone;
  2551. -
  2552. -  return(ret);
  2553. -}
  2554. -
  2555. -
  2556. -/****************************************************************************
  2557. -put a 8 byte filetime from a time_t
  2558. -This takes real GMT as input and converts to kludge-GMT
  2559. -****************************************************************************/
  2560. -void put_long_date(char *p,time_t t)
  2561. -{
  2562. -  uint32 tlow,thigh;
  2563. -  double d;
  2564. -
  2565. -  if (t==0) {
  2566. -    SIVAL(p,0,0); SIVAL(p,4,0);
  2567. -    return;
  2568. -  }
  2569. -
  2570. -  /* this converts GMT to kludge-GMT */
  2571. -  t -= TimeDiff(t) - serverzone; 
  2572. -
  2573. -  d = (double) (t);
  2574. -
  2575. -  d += TIME_FIXUP_CONSTANT;
  2576. -
  2577. -  d *= 1.0e7;
  2578. -
  2579. -  thigh = (uint32)(d * (1.0/(4.0*(double)(1<<30))));
  2580. -  tlow = (uint32)(d - ((double)thigh)*4.0*(double)(1<<30));
  2581. -
  2582. -  SIVAL(p,0,tlow);
  2583. -  SIVAL(p,4,thigh);
  2584.  }
  2585.  
  2586.  /*******************************************************************
  2587. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha3/source/version.h samba-1.9.16alpha4/source/version.h
  2588. --- samba-1.9.16alpha3/source/version.h    Wed May 29 17:54:53 1996
  2589. +++ samba-1.9.16alpha4/source/version.h    Sat Jun  1 01:15:58 1996
  2590. @@ -1 +1 @@
  2591. -#define VERSION "1.9.16alpha3"
  2592. +#define VERSION "1.9.16alpha4"
  2593.